• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Sprite not showing in platformer

A

alvarosaez316

Guest
Hi, I'm making Meteoric Balls, a platform game with very little inspiration in Megaman. Yesterday I was coding some idea and the sprite of the player stopped showing in-game.
Here's the code of the step event:

Code:
//Custom Physics
if sprite_index=BallJump_spr {
y -= force;
if force=-13{
}
else{
force-=1;
};
if place_meeting(x,y+20,brick_obj) and jump=1
{
sprite_index=BallStill;
jump=0;
action=0
}
else{
}
}
if jump=0
{
force=12
}

if place_meeting(x,y,brick_obj)
{
}

else
{
if jump=0 or shift=0
{
y+=10
}
else
{
}
}

//Movement
if keyboard_check(ord("D"))
{
direction=0 
speed=10
}
else
{
if keyboard_check(ord("A"))
{
direction=180 
speed=10
}
else
{
speed=0
}
}

//God-Like movement step part
if keyboard_check(vk_shift)
{
if shiftcount>0
{
shiftcount-=1
}
else{
alarm[0]=1;
alarm[1]=450
}
}

Alarm[0]:
Code:
speed=0
sprite_index=Rolling
Alarm[1]:
Code:
shiftcount=100
Shift Press/Release:
Code:
//Press
shift=1
sprite_index=Magic
//Realease
shift=0
sprite_index=BallStill
W press:
Code:
if shift=1
{
direction=90 
speed=10 
shift=0 
alarm[0]=50
}
else{
sprite_index=BallJump_spr
jump=1
action=1
}
A (is EXACTLY the opposite with D):
Code:
//Shift check
if shift=1
{
direction=180 
speed=10 
shift=0 
alarm[0]=50
}
else{
if sprite_index=BallStill
{
sprite_index=Rolling
}
else
{
}
image_angle-=9
}
Problem:Ball-Family sprites not showing, but shiftcount decreases when shift is pressed.
 
Last edited by a moderator:

marasovec

Member
Readability of this is terrible. Maybe if you manage the code like in GML, C# or Java it would be much easier to debug the game. I also noticed you aren't using ! (not). Like here:
Code:
if force == -13
{}
else
{
    force -= 1;
}
You can use this instead
Code:
if force != -13
{
    force -= 1;
}
 
Top