Since working on the flash game project I have regained mhy interest in programming and am learning further about actionscript and programming in general.
I am currently working on understanding object movements and the maths behind the movement of objects. Using the code from a reply to a message in a forum (http://www.kirupa.com/forum/showthread.php?p=2297490) I have created a simple movement of a block which moves where you click the mouse.
The object does not stop when it reaches where the player clicked, however. Although I will experiment into how to make it stop when it does reach the location, I also think the block continuing to move would make a good little game if it were to bounce on the walls or to loop back round the other side, or give game over if you go off the side (probably the easiest method for now). By adding objects to collect and avoid this could be a nice quick little game.
Link: http://www.fileden.com/files/2007/11/6/1567526/2.swf
3 comments:
The way to get a movieclip to go towards the mouse on click and stop where the mouse clicked is to use a tween!
search the flash help for the Tween constructor. everything you need is in there! if you can't figure it out ask me or gav as we both learnt how to use it in the project!
Having said that, you could use the code in that post and use an if statement that says if object.x = click.x and same for y then dont run the code..
yeah I'm just trying to mess around with code and stuff at the moment not really trying to do anything specific. For some reason the if x and y are the same thing didn't work when I tried the other day though but never mind.
Post a Comment