Page 1 of 1

Where is that demo...

PostPosted: Fri Jun 13, 2008 1:55 am
by Game A Gogo
I used to have a demo (1-2 years ago) that showed how to make like "space" movement.

Like you are a ship in space, you need to use your trust to move, and it's not direct like if it was with friction... like you can rotate but without changing your course, but when you trust, it moves smoothly towards the point you are facing...

get what I mean? D:

if so... can anyone make me a demo for that???
I lost the one I had...

(I remember the demo I had was like a rocket and you could move it around and stuff... and after 1h30 or searching... I cracked up and I am asking for help)

OFF_TOPIC=
freaky how my English improved since I first joined this forum lol, gotta keep in mind that it was like 3 years ago lol

Re: Where is that demo...

PostPosted: Fri Jun 13, 2008 2:54 am
by pyrometal
lol, I'll make a demo! I can't garantee amazing sprites though... This is rather simple physics and yet, is really fun to toy around with!

Re: Where is that demo...

PostPosted: Fri Jun 13, 2008 5:15 am
by pyrometal
Here it is!

SpaceMove demo.zip
Ask questions if necessary
(10.3 KiB) Downloaded 103 times


Controls:
UP -> Accelerate in wanted direction.
DOWN -> Decelerate to velocity 0.
RIGHT -> Turn clockwise.
LEFT -> Turn counterclockwise.
SPACE -> shoot laser

I also included an extra! You can shoot lasers in any direction which has a relative velocity to the player (physics). That means, the laser gets the players original velocity PLUS its own initial velocity added to it vectorially. (its exactly like throwing a baseball out of a rolling car). The laser is set to move away from the player at a velocity of 12. The code is simple, so I didn't put comments, it should be fairly straight foward once you see it.

--pyro

Re: Where is that demo...

PostPosted: Fri Jun 13, 2008 10:59 am
by Game A Gogo
thx a bunch :D
this what I wanted exactly :3
just need to modify the code a bit to make it able to boost by pressing Ctrl, and make it move slower.
thx again :D

btw, here is another point :P

Re: Where is that demo...

PostPosted: Fri Jun 13, 2008 3:30 pm
by pyrometal
I just discover that the relative velocity doesn't work very well for some odd reason... I may try to fix this...

Re: Where is that demo...

PostPosted: Fri Jun 13, 2008 3:40 pm
by pyrometal
Ok, to fix the problem, replace the code located in the laser's create actor event with the following:

Code: Select all
double mem = 2*PI*ROT_fraction[0]/ROT_fraction[1];

xvelocity = 12*cos(mem) + creator.xvelocity;
yvelocity = 12*sin(mem) + creator.yvelocity;
r=0; b=0;

Re: Where is that demo...

PostPosted: Fri Jun 13, 2008 5:19 pm
by Game A Gogo
yeah I have already seen that. but I used this instead:
Code: Select all
angle=360-ship_angle+90;
directional_velocity=creator.directional_velocity+24;

figured it would require less CPU. go see "Sneak Peak => Space Traveler" if you wanna see why I wanted these and the rotation code :3