directional moving according to animation

Game Editor comments and discussion.

directional moving according to animation

Postby J Maker » Tue Oct 21, 2008 1:39 am

OK, I am making an asteroid type game where up and down change the animation and space moves the ship in the direction the ship is facing. the only problem is that i don't know how to make the ship move in the direction the ship is facing, but i know its possible so if anyone can do that if u can give me the codes that would be great. :D

P.S: please don't post a demo unless u have GE 1.3.8 because I wouldn't be able to open anything else. Thanks :D
Some people believe Chuck Norris evolved from a dinosaur, the Chucknorisaurus.
----------------------------------------------------------------------------------
Chuck Norris doesn't sleep, he waits.
----------------------------------------------------------------------------------
Chuck Norris doesn't hunt, he kills.
----------------------------------------------------------------------------------
Chuck Norris once shot down a german fighter plane with his finger by yelling BANG!!!
----------------------------------------------------------------------------------
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score

Re: directional moving according to animation

Postby zygoth » Wed Oct 22, 2008 12:08 am

you will need to have your animations starting at 0 degrees or facing right, then going counterclockwise until just before being at 90 degrees again

KeyDown-Space-repeat every frame

angle = (animpos/nframes)*360;
x = x + (cos(angle)*[speed of movement])
y = y - (sin(angle)*[speed of movement])

tell me if there is something wrong with this.
Nova: 100% Vertigo/Mazeman: 100%
Visit my website to download them both! http://www.ketonegames.com
User avatar
zygoth
 
Posts: 140
Joined: Mon Jun 11, 2007 6:37 pm
Score: 5 Give a positive score

Re: directional moving according to animation

Postby J Maker » Sun Oct 26, 2008 1:43 am

sry for delayed response havn't checked forum in a while, I tried the code and it showed me this:
Attachments
code-prob.PNG
Some people believe Chuck Norris evolved from a dinosaur, the Chucknorisaurus.
----------------------------------------------------------------------------------
Chuck Norris doesn't sleep, he waits.
----------------------------------------------------------------------------------
Chuck Norris doesn't hunt, he kills.
----------------------------------------------------------------------------------
Chuck Norris once shot down a german fighter plane with his finger by yelling BANG!!!
----------------------------------------------------------------------------------
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron