Making a simple game in flash, how do I make the object keep going even when the mouse..

Matt

New member
I don't really use flash, but I've written games in other languages, so I can try to help you but I can't give any actual code. First of all, the object should have attributes x and y (its x-position and y-position) and dx and dy (its horizontal velocity and vertical velocity). When you want it to start moving, set dx and/or dy to something non-zero. When you want it to stop, set dx and dy to zero. To make it keep going, you just have to add dx to x and dy to y every frame. To make it change its horizontal direction, just multiply dx by -1, and to change vertical direction, multiply dy by -1. To detect the collision between the object and the wall, you have to compare the two objects' x- and y-positions.
 
...is released? Also, how can I make it so that it bounces off a wall when it hits the wall. I don't want it to stop, I want it to go the other direction.
Wow. I need someone who actually uses flash. Could you give me a code? Matt's answer was pathetic.
 
I don't really use flash, but I've written games in other languages, so I can try to help you but I can't give any actual code. First of all, the object should have attributes x and y (its x-position and y-position) and dx and dy (its horizontal velocity and vertical velocity). When you want it to start moving, set dx and/or dy to something non-zero. When you want it to stop, set dx and dy to zero. To make it keep going, you just have to add dx to x and dy to y every frame. To make it change its horizontal direction, just multiply dx by -1, and to change vertical direction, multiply dy by -1. To detect the collision between the object and the wall, you have to compare the two objects' x- and y-positions.
 
Back
Top