Timer Inteference

kyl35umm3r5

New member
Joined
Aug 12, 2013
Messages
2
Programming Experience
Beginner
I have been using a timer to enable "space monsters" to move down then form. I have also used a timer for a missile which is fired by the space ship (has a space rangers like appearance). The two timers interfere with each other. Whenever the missile is moving up the form, if the timer ticks for the space monsters, the missile timer pauses for a moment and then continues.

Sorry in advance if this is in the wrong area, I had a look and this seemed most appropriate.
 
Each thread can only do one thing at a time. If you have two WinForms Timers then they will both raise their Tick event on the UI thread and that thread can only execute the handler for one at a time.

What is the Interval of each of the Timers? Quite possibly you can get away with just using one and making all the changes in the same Tick event. Also, how are you representing each game element? If you're using multiple PictureBoxes then you could make it more efficient by using one big PictureBox and using GDI+ to draw the elements onto that yourself.
 
Each thread can only do one thing at a time. If you have two WinForms Timers then they will both raise their Tick event on the UI thread and that thread can only execute the handler for one at a time.

What is the Interval of each of the Timers? Quite possibly you can get away with just using one and making all the changes in the same Tick event. Also, how are you representing each game element? If you're using multiple PictureBoxes then you could make it more efficient by using one big PictureBox and using GDI+ to draw the elements onto that yourself.

I have different intervals for explosion (image collection 100), missile(20) and enemies (1000). Good idea with the same tick event. Thank you
 
Back
Top