Discuss Scratch

LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

On my most recent game, the character seems to glitch through the walls/move without command until not touching the color black if you are pressing one key, and then switch to another. I don't want my character to leave the area. My game is 2D (top view) and a Prison Break game. Hope you can help! Thanks, LegoCreep.

Last edited by LegoCreep (May 19, 2015 21:41:46)

GuyOfCoding
Scratcher
66 posts

2D Game (Top View) Glitchy Character - Goes through Walls

Try using:

whenclickedforeveriftouchingcolorblack?thenmove-10steps
LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

GuyOfCoding wrote:

Try using:

whenclickedforeveriftouchingcolorblack?thenmove-10steps
I kind of already have that in my script, and it isn't a side view 2D game, it's a top view. I would check it out so you can see for yourself. Thanks for the help though!
GuyOfCoding
Scratcher
66 posts

2D Game (Top View) Glitchy Character - Goes through Walls

Interesting script setup. I say that you probably forgot to have it realize that even when the character is going backwards, it still has to get put back to mapX or mapY
LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

GuyOfCoding wrote:

Interesting script setup. I say that you probably forgot to have it realize that even when the character is going backwards, it still has to get put back to mapX or mapY
Hmm? I don't understand what you mean.
LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

LegoCreep wrote:

GuyOfCoding wrote:

Interesting script setup. I say that you probably forgot to have it realize that even when the character is going backwards, it still has to get put back to mapX or mapY
Hmm? I don't understand what you mean.
Since the character isn't moving at all (at least it's sprite) and only the map is ACTUALLY moving you are confusing me.
GuyOfCoding
Scratcher
66 posts

2D Game (Top View) Glitchy Character - Goes through Walls

What I mean is that I don't think you programmed it to move the character back even when walking backwards into the wall. If not that, then what also could have been the problem is that instead of moving to where there is no wall, it continues to run a script telling it to go into the wall.
LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

GuyOfCoding wrote:

What I mean is that I don't think you programmed it to move the character back even when walking backwards into the wall. If not that, then what also could have been the problem is that instead of moving to where there is no wall, it continues to run a script telling it to go into the wall.
How should I make that script then?
LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

GuyOfCoding wrote:

What I mean is that I don't think you programmed it to move the character back even when walking backwards into the wall. If not that, then what also could have been the problem is that instead of moving to where there is no wall, it continues to run a script telling it to go into the wall.
I can't figure out how to make the script.
GuyOfCoding
Scratcher
66 posts

2D Game (Top View) Glitchy Character - Goes through Walls

Idk. Try tweaking each of your scripts and you should be able to find what's wrong.
mekizmo
Scratcher
51 posts

2D Game (Top View) Glitchy Character - Goes through Walls

It seems that the problem occurs when you are in a corner, and touch black on two different sides. Assume you are in a bottom left corner, and want to move left. Your code says:
iftouchingcolor?thenrepeatuntilnottouchingcolor?change MAP.Xby-1
Since you are touching black, you move 1 step right; but since you are still touching black, you keep moving more and more steps, regardless whether there's another wall on your right.

What I suggest is that the color you use for the horizontal walls should be slightly different from the one that you usee for vertical ones.

Last edited by mekizmo (May 19, 2015 23:59:18)

GuyOfCoding
Scratcher
66 posts

2D Game (Top View) Glitchy Character - Goes through Walls

Agree
LegoCreep
Scratcher
24 posts

2D Game (Top View) Glitchy Character - Goes through Walls

mekizmo wrote:

It seems that the problem occurs when you are in a corner, and touch black on two different sides. Assume you are in a bottom left corner, and want to move left. Your code says:
iftouchingcolor?thenrepeatuntilnottouchingcolor?change MAP.Xby-1
Since you are touching black, you move 1 step right; but since you are still touching black, you keep moving more and more steps, regardless whether there's another wall on your right.

What I suggest is that the color you use for the horizontal walls should be slightly different from the one that you usee for vertical ones.
Oh yeah! Never though of that! Thanks!
GuyOfCoding
Scratcher
66 posts

2D Game (Top View) Glitchy Character - Goes through Walls

How do I become a Scratcher?

Powered by DjangoBB