walking speed sometimes changes, as does jump height?

Game Editor comments and discussion.

walking speed sometimes changes, as does jump height?

Postby PooAs » Sun Apr 20, 2008 9:52 am

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;
 
}
If you try
to fix violence
with violence
you do nothing
but create violence
User avatar
PooAs
 
Posts: 29
Joined: Thu Apr 03, 2008 10:24 am
Score: 3 Give a positive score

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

Postby PooAs » Mon Apr 21, 2008 10:23 pm

and when i turn motion compensation off the jump thing stops but eveerything is slow
even on 120 fps
If you try
to fix violence
with violence
you do nothing
but create violence
User avatar
PooAs
 
Posts: 29
Joined: Thu Apr 03, 2008 10:24 am
Score: 3 Give a positive score

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

Postby DST » Tue Apr 22, 2008 3:55 am

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.)
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

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

Postby PooAs » Tue Apr 22, 2008 6:24 am

how would i add that to my script^^
lol
as all the moving atributes are in the script above
User avatar
PooAs
 
Posts: 29
Joined: Thu Apr 03, 2008 10:24 am
Score: 3 Give a positive score

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

Postby Bee-Ant » Tue Apr 22, 2008 8:22 am

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
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

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

Postby PooAs » Tue Apr 22, 2008 11:25 am

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
If you try
to fix violence
with violence
you do nothing
but create violence
User avatar
PooAs
 
Posts: 29
Joined: Thu Apr 03, 2008 10:24 am
Score: 3 Give a positive score

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

Postby Bee-Ant » Tue Apr 22, 2008 12:03 pm

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
Attachments
specify.PNG
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

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

Postby PooAs » Tue Apr 22, 2008 10:20 pm

thanks heaps bee-ant
you really are a god among men in this world of game-editor :D lol
thanks again

PooAs
If you try
to fix violence
with violence
you do nothing
but create violence
User avatar
PooAs
 
Posts: 29
Joined: Thu Apr 03, 2008 10:24 am
Score: 3 Give a positive score

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

Postby Bee-Ant » Wed Apr 23, 2008 1:36 pm

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...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron