B
bluepill
Guest
Hi, I have a little test project where I'm trying out ways to stop my player sprite from leaving the play area. I have this bit of drag and drop:
The player moves to the left when the left arrow key is pressed. What this is trying to do is stop them moving to the left when the collision shape (rectangle) is hit.
What happens when I run this is the player keeps moving to the left. I added the debug message to try and see what was going on and it doesn't get displayed; so there is something wrong with how I did this or my understanding of what "if collision shape" does. Also, this is the only place in the code where the player is moved to the left and there is a collision mask for the player that works when colliding with other objects in the project.
If anyone has an idea of what I've done wrong (I assume it's something really simple) I'd appreciate some help.
Thanks
The player moves to the left when the left arrow key is pressed. What this is trying to do is stop them moving to the left when the collision shape (rectangle) is hit.
What happens when I run this is the player keeps moving to the left. I added the debug message to try and see what was going on and it doesn't get displayed; so there is something wrong with how I did this or my understanding of what "if collision shape" does. Also, this is the only place in the code where the player is moved to the left and there is a collision mask for the player that works when colliding with other objects in the project.
If anyone has an idea of what I've done wrong (I assume it's something really simple) I'd appreciate some help.
Thanks