• 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!

GameMaker Does anyone have problems with sprites disappearing/phasing through things?

I'm trying to make an RPG-type game, and whenever I turn my character upwards, his sprite disappears and he phases through walls. Only when he's facing upwards, though-- left, right, and downwards work fine, but when he's turned upwards, everything is skewed. I can't figure out what I'm doing wrong, or what's wrong, since I'm following a tutorial to a t. Has anyone else had this problem? Does anyone know how to fix it, or do I just need to start over? I'm not missing any semicolons or anything.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I can't figure out what I'm doing wrong, or what's wrong, since I'm following a tutorial to a t.
At the risk of being that one person: You probably aren't.

That aside, with no code and no visual demonstration or anything, I'm afraid there's not much we can help you with. Could you please share something that illustrates the issue as well as code related to it?
 
At the risk of being that one person: You probably aren't.

That aside, with no code and no visual demonstration or anything, I'm afraid there's not much we can help you with. Could you please share something that illustrates the issue as well as code related to it?
It's alright, be that one person, I might've, and probably did, overlook something. That's why I came here!

I'll do my best. The tutorial itself is Peyton Burnham (on YouTube)'s RPG tutorial. Only thing I changed was the input keys, from the arrow keys to WASD. but I'm not sure that'd mess everything up like it did. Unfortunately I'm not able to record a video of what's happening, but this is the code for Ocean's movement.

[under a create event]

xspd = 0;
yspd = 0;

move_spd = 1;

sprite
= sprite_ocean_right;
sprite[UP] =-sprite_ocean_backwards;
sprite
= sprite_ocean_left;
sprite[DOWN] = sprite_ocean_forwards;

face = DOWN;

[under a step event]

up_key = keyboard_check(ord("W"))
left_key = keyboard_check(ord("A"))
down_key = keyboard_check(ord("S"))
right_key = keyboard_check(ord("D"))

xspd = (right_key - left_key) * move_spd;
yspd = (down_key - up_key) * move_spd;


//set sprite
if yspd == 0

{
if xspd > 0 {face = RIGHT};
if xspd < 0 {face = LEFT};
}

if xspd == 0
{
if yspd > 0 {face = DOWN};
if yspd < 0 {face = UP};
}

sprite_index = sprite[face];


//collisions

if place_meeting(x + xspd, y, obj_wall) == true
{
xspd = 0;
}

if place_meeting(x, y + yspd, obj_wall) == true
{
yspd = 0;
}

x += xspd;
y += yspd;


if xspd == 0 && yspd == 0
{
image_index = 0;

Nothing else is coded yet, since I just got to working on it. I'll do my best to get a screen recording of what's happening when I try to run the game.​
 

Chaser

Member
Is image index 0 empty? You set it to zero in the step event, so the sprite will stay at 0 and not animate.
 
Top