Page 1 of 1

walking speed sometimes changes, as does jump height?

PostPosted: Sun Apr 20, 2008 9:52 am
by PooAs
i recently changed my framerate from 30 to 60
because of bullet missing enemy..etc
...
now when the actor is walking every 3 seconds or so he speeds up then slows down
and on top of that when he jumps he jumps higher and faster so ifyou keep jumping you will eventually jump past the screen and die. lol
help?

here is my actor script..

Code: Select all
char*key=GetKeyState();
int spd = 5;
yvelocity += gravity;
if(damage > 100)DestroyActor("Event Actor");
if(wt > 0)wt--;
else
if(key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0)
{
    if(j == 0 && xvelocity > -spd)xvelocity--;
    if(j == 1)x -= spd;
    if(ld == 1)
    {
        ld = 0;
        af = 1;
    }
    if(af == 1)
    {
        ChangeAnimation("Event Actor", "RANDAL- pistols left walk 1", FORWARD);
        af = 0;
    }
}
if(key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 1)
{
    if(j == 0 && xvelocity < spd)xvelocity++;
    if(j == 1)x += spd;
    if(ld == 0)
    {
        ld = 1;
        af = 1;
    }
    if(af == 1)
    {
        ChangeAnimation("Event Actor", "RANDAL- pistols right walk 1", FORWARD);
        af = 0;
    }
}
if(key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 0)
{
    af = 1;
    if(ld == 0)ChangeAnimation("Event Actor", "RANDAL pistol left", FORWARD);
    else ChangeAnimation("Event Actor", "RANDAL pistol right", FORWARD);
}
if(key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 1)
{
    af = 1;
    if(ld == 0)ChangeAnimation("Event Actor", "RANDAL pistol left", FORWARD);
    else ChangeAnimation("Event Actor", "RANDAL pistol right", FORWARD);
}
if(j == 1 && key[KEY_z] == 1)
{
    if(key[KEY_LEFT] == 1)xvelocity = -spd;
    if(key[KEY_RIGHT] == 1)xvelocity = spd;
    yvelocity = -(gravity * 13);
    j = 0;
 
}

Re: walking speed sometimes changes, as does jump height?

PostPosted: Mon Apr 21, 2008 10:23 pm
by PooAs
and when i turn motion compensation off the jump thing stops but eveerything is slow
even on 120 fps

Re: walking speed sometimes changes, as does jump height?

PostPosted: Tue Apr 22, 2008 3:55 am
by DST
Lol you don't need 120 frames. Your first problem, i think, is that you are using a physical response with the ground/platform, right? Physical response affects xvelocity. On the key>keyright, use "x+=4;" instead of xvelocity.
Solid x values like that won't be affected by the physical response.

And the second thing....sounds like you're moonjumping. Use a variable 'canjump'. Enable it when he collides with ground, disable it when jump button is pressed. And on jump button
Code: Select all
if (canjump == 1){yvelocity -= whatever;}

(with jumping, you do want to use yvelocity instead of y-=n.)

Re: walking speed sometimes changes, as does jump height?

PostPosted: Tue Apr 22, 2008 6:24 am
by PooAs
how would i add that to my script^^
lol
as all the moving atributes are in the script above

Re: walking speed sometimes changes, as does jump height?

PostPosted: Tue Apr 22, 2008 8:22 am
by Bee-Ant
To make your bullet dont miss your enemy you can use directional_velocity
DST right, physical response which use calculated will affects xvelocity, try to use specify

Re: walking speed sometimes changes, as does jump height?

PostPosted: Tue Apr 22, 2008 11:25 am
by PooAs
thats bee-ant!
ok the first part worked

directional_velocity = 18;
but
directional_velocity = -18;
stuffs up it like creates the actor and it just shakes heaps???
...
also i didnt get the second half of your comment lol
thanks
pooAs

Re: walking speed sometimes changes, as does jump height?

PostPosted: Tue Apr 22, 2008 12:03 pm
by Bee-Ant
No...your directional_velocity direction depend on your angle. For example if you wanna make your bullet move to the right, use this code
Code: Select all
angle=0;
directional_velocity=18;

If you wanna make your bullet move to the left, use this code
Code: Select all
angle=180;
directional_velocity=18;

To move up angle=90; ,down angle=270; and so on... :D
Here's what I mean with use specify

Re: walking speed sometimes changes, as does jump height?

PostPosted: Tue Apr 22, 2008 10:20 pm
by PooAs
thanks heaps bee-ant
you really are a god among men in this world of game-editor :D lol
thanks again

PooAs

Re: walking speed sometimes changes, as does jump height?

PostPosted: Wed Apr 23, 2008 1:36 pm
by Bee-Ant
PooAs wrote:you really are a god among men in this world of game-editor :D

:lol: :lol: :lol:
excessive...
No probs...you're welcome...