Page 1 of 1

Is this Collide command Viable?

PostPosted: Tue Apr 27, 2010 7:57 am
by poopbrigade
is this possible????
I want my player to move up when it collides with spring(by the way I've noticed that -y is up and +y is down should it be the other way around?)


if (CollisionFree("Event Actor", spring.x, spring.y)) y=y-5;

Re: Is this Collide command Viable?

PostPosted: Tue Apr 27, 2010 1:23 pm
by Hblade
Wouldn't this work?

Coliision with Spring from character:
Code: Select all
yvelocity-=32;

That should simulate a basic method of bouncing off of a spring :D

Re: Is this Collide command Viable?

PostPosted: Tue Apr 27, 2010 5:44 pm
by Thanx
actually that code should be
Code: Select all
yvelocity = -32;

Because HBlade's code only subtracted from the already existing yvelocity... So if it were faster, it still would have continued falling, just at a slower speed.
If you want to simulate faster objects being accelerated better, then I suggest something like this:
Code: Select all
yvelocity = -32 * (yvelocity/somenumber);

In place of somenumber just write in a number which will serve as some kind of a ratio, as for how sensitive the spring is. Experiment with the number until you achieve the desired effect...
:)

Re: Is this Collide command Viable?

PostPosted: Tue Apr 27, 2010 6:08 pm
by Hblade
Wow good job thanx!