Problem with my test game

Non-platform specific questions.

Problem with my test game

Postby Shokupan » Tue May 01, 2012 7:35 pm

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~ :?
Attachments
Beegame.exe
(1.46 MiB) Downloaded 64 times
User avatar
Shokupan
 
Posts: 2
Joined: Mon Apr 30, 2012 9:10 pm
Location: Frankfurt, Germany
Score: 0 Give a positive score

Re: Problem with my test game

Postby MrJolteon » Wed May 02, 2012 7:45 am

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))
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest