Page 1 of 1

Problem with my test game

PostPosted: Tue May 01, 2012 7:35 pm
by Shokupan
Hey guys, I'm a newbie !

Here's my problem:

I want to make a platformer game. When I jump to the right or left side, there's always a short run animation. I don't want a run animation while I'm jumping/falling. :/

That's the draw actor code:

Code: Select all
float MSensor=1.2;
char*key=GetKeyState();
xvelocity=(key[KEY_RIGHT]-key[KEY_LEFT])*8;
if(abs(xvelocity)>0&&CollisionFree("Event Actor",x+xvelocity,y-5)&&CollisionFree("Event Actor",x+xvelocity,y-20)==0)y-=2;
else if(CollisionFree("Event Actor",x+xvelocity,y-5)==0)xvelocity=0;

if(abs(xvelocity)>0)PlayerWD=xvelocity/abs(xvelocity);
 if(xvelocity>=MSensor&&abs(yvelocity)<=MSensor)ChangeAnimation("Hero", "Bee_Run_Right", NO_CHANGE);
else if(xvelocity<=-MSensor&&abs(yvelocity)<=MSensor)ChangeAnimation("Hero", "Bee_Run_Left", NO_CHANGE);
if(abs(xvelocity)<MSensor&&abs(yvelocity)<=MSensor)
{
    if(PlayerWD==1)ChangeAnimation("Hero", "Bee_Stop_Right", NO_CHANGE);
    else ChangeAnimation("Hero", "Bee_Stop_Left", NO_CHANGE);
}
if(yvelocity>=MSensor)
{
    if(PlayerWD==1)ChangeAnimation("Hero", "Bee_Fall_Right", NO_CHANGE);
    else ChangeAnimation("Hero", "Bee_Fall_Left", NO_CHANGE);
}
else if(yvelocity<=-MSensor)
{
    if(PlayerWD==1)ChangeAnimation("Hero", "Bee_Jump_Right", NO_CHANGE);
    else ChangeAnimation("Hero", "Bee_Jump_Left", NO_CHANGE);
}
if(CollisionFree("Event Actor",x,y+yvelocity)||CollisionFree("Event Actor",x,y+yvelocity+1)){yvelocity+=0.4;Jump=0;}
else {yvelocity=0;if(CollisionFree("Event Actor",x,y+yvelocity-4)==0)Jump=0;else Jump=1;}
yvelocity-=key[KEY_SPACE]*Jump*8;


Got it from a mario example on this forum.

I hope somebody can help me~ :?

Re: Problem with my test game

PostPosted: Wed May 02, 2012 7:45 am
by MrJolteon
We can't help you if you just upload a game exe, you need to upload the source if you want help
(And besides, not everyone here is on Windows, there are some Mac/Linux users here, and I'm one of them (I use Ubuntu))