A small problem .

Game Editor comments and discussion.

A small problem .

Postby kingqui » Wed Feb 20, 2008 7:14 am

Can som1 help me with this i hav added the char.to walk and jump but when he jumps you can keep on pressing the spacebar to jump which is annoyin becoz i only want him to jump once at a time can any1 fix this and perhaps explain how uu done it,
also when i walk over a particular surface i fall??? dont know why??
One more thing i want to add friction to my walking i hav tried but not succeded by adding an actor, using the keydown event typing in xvelocity = 5; and on the draw actor xvelocity = xvelocity + 1 but the animation jsut goes off to the right can u explain and hep on this topic too plz??
plz help and explain.. =)
kingqui
 
Posts: 12
Joined: Tue Feb 19, 2008 5:14 pm
Score: 0 Give a positive score

Re: A small problem .

Postby Thanx » Wed Feb 20, 2008 10:51 am

You need a variable, that is 1 while you are colliding, and when you stop colliding, it is 0. In the jump, use an if statement, like this:
Code: Select all
if(collidevariable == 1)
{
    code for jumping goes here...
}

This way you will jump only when you're colliding with the platform...
I'm not sure wether I understand your problem, but I think you mean, that your actor doesn't stop. So, in the Key up, of the actor, you must say xvelocity = 0; So that it stops. But I don't know what you mean by adding friction... :(
Anyway, I hope this helped! :)
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron