Page 1 of 2

Stop Movement only if .....

PostPosted: Wed Aug 13, 2008 3:03 pm
by paperboy321
I already made it so when u push ctrl it stops all movement :D by puting key down (ctrl)- script editor and i put

yvelocity = yvelocity = 0;
xvelocity = xvelocity = 0;

and it makes it stop, but how to you make it so you only can
make it stop when it is toughting ( coliding repidetly )
the ground or platform :?: :?: :?:


Thanks ahead of time. :D

Re: Stop Movement only if .....

PostPosted: Wed Aug 13, 2008 9:32 pm
by Fuzzy
You can simplify those. just put
yvelocity = 0;
xvelocity = 0;


The format is

destination = math formula;

so you dont need that second =

You can do smart programming though and type

xvelocity = yvelocity = 0;

and it works it out from left to right with the final result being that both xvelocity and yvelocity equal zero.

Re: Stop Movement only if .....

PostPosted: Thu Aug 14, 2008 8:04 am
by Thanx
On Colision event do
xvelocity = yvelocity = 0;
Try that out! Is that what you wanted? :?: :)

Re: Stop Movement only if .....

PostPosted: Thu Aug 14, 2008 9:11 pm
by paperboy321
Thanx wrote:On Colision event do
xvelocity = yvelocity = 0;
Try that out! Is that what you wanted? :?: :)


No i wanted it so that you only can push ctrl
( make it stop ( using xvelocity = yvelocity = 0 )
when it is toughting a platform or the ground.

Re: Stop Movement only if .....

PostPosted: Thu Aug 14, 2008 9:14 pm
by paperboy321
Fuzzy wrote:You can simplify those. just put
yvelocity = 0;
xvelocity = 0;


The format is

destination = math formula;

so you dont need that second =

You can do smart programming though and type

xvelocity = yvelocity = 0;

and it works it out from left to right with the final result being that both xvelocity and yvelocity equal zero.



:?: :?: :?:

ok thanks, but that is not my question

Re: Stop Movement only if .....

PostPosted: Fri Aug 15, 2008 9:46 am
by Thanx
ok, I think I get what you want now! :P
Make a variable, maybe called collisioncount
On Create actor
collisioncount = 0;
On Collision event
collisioncount ++;
if(collisioncount = somenumber)
{
xvelocity = yvelocity = 0;
collisioncount = 0;
}
That should do it I think right there somenumber = the number of collisions the actor should go through before stopping.

Re: Stop Movement only if .....

PostPosted: Fri Aug 15, 2008 7:12 pm
by paperboy321
can u please :D :D show me by making a demo starting with stopping by pushing ctrl and doing that
i dont understand how to make a variable and other stuff like that. :oops:

thanks alot please reply quickly

Re: Stop Movement only if .....

PostPosted: Fri Aug 15, 2008 11:02 pm
by BlarghNRawr
so you want ur char to stop on the platform, by pressing ctrl...
but if you press ctrl in the air, nothing happens?

Re: Stop Movement only if .....

PostPosted: Sat Aug 16, 2008 1:34 pm
by Thanx
I realized that I misunderstood you the last time too :oops:
But here's what you wanted, the demo making of your question's answer.
Note 1: Making a variable is done by clicking the variables button in the script editor, then clicking add. There specify name, and type, addictionally wether all actors can use the variable, or only the actor you're working with at the moment.

Note 2: I've changed the way of moving the character, compared to the demos, to make this work. Instead x = x + 5; (or x+=5; ) , to xvelocity = 5; There's another way of doing it, which I only just thought of now, which includes enabling/disabling actions. But this I believe will be better for you, so you get to know some more coding, which will be required if you continue to the more advanced levels... :wink: :)
ctrldemo.zip
The demo. Study! :)
(43.28 KiB) Downloaded 164 times

Note 3: I made 2 extra variables. 1 to make sure the ctrl only takes effect when colliding, 2 so that ctrl actually can stop the actor even if constntly pushing the arrow keys...

Study & enjoy! Hope you understand!
If you ave any questions, or anything you want to do differently, and/or want to know about the second way of doing it, just say so! :wink:

Re: Stop Movement only if .....

PostPosted: Wed Aug 20, 2008 1:59 pm
by paperboy321
when ever i download it i extrct it and play it but it say u need newer version but i already updated my version. :?: :?: :o :o

Re: Stop Movement only if .....

PostPosted: Wed Aug 20, 2008 2:01 pm
by paperboy321
blarghNRawr wrote:so you want ur char to stop on the platform, by pressing ctrl...
but if you press ctrl in the air, nothing happens?



:D :D Correct :D :D

Re: Stop Movement only if .....

PostPosted: Wed Aug 20, 2008 2:04 pm
by paperboy321
paperboy321 wrote:when ever i download it i extrct it and play it but it say u need newer version but i already updated my version. :?: :?: :o :o


( Game Editor 1.3.9 )

Re: Stop Movement only if .....

PostPosted: Wed Aug 20, 2008 2:18 pm
by paperboy321
paperboy321 wrote:
paperboy321 wrote:when ever i download it i extrct it and play it but it say u need newer version but i already updated my version. :?: :?: :o :o


( Game Editor 1.3.9 )


NeverMind

Re: Stop Movement only if .....

PostPosted: Wed Aug 20, 2008 2:42 pm
by paperboy321
please here is my game i tryed everything to fix it and cant do it can u return fixed version :oops: :oops: ( I got that game from someone else and made big changes. ) :oops: :oops: :oops: THANKS SO MUCH ( Without this forum I would never make a game )

I Do Not Have Screen Shots "Sorry"

Re: Stop Movement only if .....

PostPosted: Wed Aug 20, 2008 2:50 pm
by pyrometal
Good work! Keep on improving, then you'll se soon enough you'll be able to make your games form complete scratch! Don't ever give up, take as much time as you need to complete these projects, no one is pressuring you right now but yourself. I'll be looking foward to seeing more of your stuff. ttyl

--pyro