This content has been marked as final. Show 7 replies
check out some of the amazing work here:
that should get you started.
If you look at your code you can see at the third line that you have hard coded which direction the image should move, that's what makes it always go left (anim="left")
Also move go the frame to the end of exitframe. The rest of the code should preferably be run in enterframe since time consuming code in exitframe can make your program run slower (due to how director calculates frame rate delays)
Any way, use anim as a global variable and set random initial direction of the variable in either a startMovie script or in the frame script of an earlier frame.
thx for the remark.. i got it working now.
but i still need the code for the random thing i mentioned above if someone can help.
This should work for you if I understood you correctly.
i need the random animation for a new sprite, its not related to the anim="left" ...
what i need is the code to make a sprite on mouseenter, disappear and appear in a random place within the 500*500 stage.
and josh i check the websites.. they are useful but i need an ebook or a website where i can get lessons and examples in lingo, starting from the basics..
for i need help to make a game as a university project, and the codes i learned are very basic.
Ah, you can still use most of the same code tho.
And here is a free ebook about game programming with director http://garyrosenzweig.com/advancedlingoforgames/ it used to be in print so if you like it support the author by buying his other book, details on the linked page.
edit: Note this code should work with any size stage and sprite.
thank u alot for ur help.. i really appreciate it