Timeline for Flash AS3 Tower Defense MouseEvents
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 26, 2011 at 18:11 | vote | accept | Sean | ||
May 25, 2011 at 9:12 | history | tweeted | twitter.com/#!/StackGameDev/status/73315559747489792 | ||
May 24, 2011 at 14:10 | answer | added | Valkea | timeline score: 3 | |
May 24, 2011 at 13:33 | comment | added | bummzack |
Sure, one event listener would also work. You could use the target property then. But not even that is required, since you could determine the clicked tile by calculating the index by using the mouse coordinates given by the event. That would allow you to use some light-weight components like Shape for your tiles, or draw the tiles directly to a bitmap.
|
|
May 24, 2011 at 13:15 | comment | added | Sean | I will try that. I was just wondering if one event listener for everything would still be better than creating an event listener for each individual object. | |
May 24, 2011 at 13:05 | comment | added | bummzack | Hm tricky. If you can somehow manage to remove the event-listeners (by pre-populating the board, so that you won't need mouse events), that would probably be the easiest way to check if the events are actually the bottleneck here. | |
May 24, 2011 at 12:52 | comment | added | Sean | The enemies on the path just stop or move slow. I wanted to start optimizing the code. Mouse Events are one of the first things I thought of. Another thing that might be slowing down my game is the sorting of the enemies. When a wave appears, the enemies in the wave are put into an array. I have enemies that are faster than others so they will pass enemies on the path. I want my towers to shoot whichever enemy is in front. To do this, each time my game updates, I find the distance traveled and sort the enemies with a bubble sort depending on which one moved the furthest. | |
May 24, 2011 at 12:39 | comment | added | bummzack | I don't have any experience with flash on mobile devices, but I find it hard to believe that it's connected to event-listeners. In what situations does your game lag? | |
May 24, 2011 at 12:24 | history | asked | Sean | CC BY-SA 3.0 |