This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-11-24 19:25:53

ArloarLoLs
Scratcher
Registered: 2012-08-27
Posts: 71

How To Make Bounds for An RPG Game?

Hi, i have an rpg game in which the character forever points at the mouse, you have WASD controls. I want the character to avoid walking when touching the color gray, therefore I made the character back off 1 step when walking towards the wall, but, if the character walk backwards in to the wall, then he can go right through. Any ideas on how to do this? Thank you.  smile

Offline

 

#2 2012-11-24 20:09:26

BomberE
Scratcher
Registered: 2009-08-25
Posts: 60

Re: How To Make Bounds for An RPG Game?

Both of the games below will help you with your project. The first one works by having walls with 4 different colours, one for each side. The character will sense whether it is touching a specific wall, and move depending on the direction. The second one works by having 4 variables; x,y, X_old, and Y_old. As the character moves it is constantly putting x and y to their respective x's and y's. If the char. isn't touching a wall, the old_Y and old_X will be set to x and y respectively. When the char. touches a wall, it will set the x and y to the old_X and old_Y. Check out the scripts for more detail.
Maze
Maze 2


check out my Minecraft Blog!

Offline

 

#3 2012-11-24 20:19:35

ArloarLoLs
Scratcher
Registered: 2012-08-27
Posts: 71

Re: How To Make Bounds for An RPG Game?

BomberE wrote:

Both of the games below will help you with your project. The first one works by having walls with 4 different colours, one for each side. The character will sense whether it is touching a specific wall, and move depending on the direction. The second one works by having 4 variables; x,y, X_old, and Y_old. As the character moves it is constantly putting x and y to their respective x's and y's. If the char. isn't touching a wall, the old_Y and old_X will be set to x and y respectively. When the char. touches a wall, it will set the x and y to the old_X and old_Y. Check out the scripts for more detail.
Maze
Maze 2

Wow I've never thought about that, THANK YOU!!!

Offline

 

#4 2012-11-24 20:32:01

ArloarLoLs
Scratcher
Registered: 2012-08-27
Posts: 71

Re: How To Make Bounds for An RPG Game?

BomberE wrote:

Both of the games below will help you with your project. The first one works by having walls with 4 different colours, one for each side. The character will sense whether it is touching a specific wall, and move depending on the direction. The second one works by having 4 variables; x,y, X_old, and Y_old. As the character moves it is constantly putting x and y to their respective x's and y's. If the char. isn't touching a wall, the old_Y and old_X will be set to x and y respectively. When the char. touches a wall, it will set the x and y to the old_X and old_Y. Check out the scripts for more detail.
Maze
Maze 2

I made this basic game with your awesome idea
http://scratch.mit.edu/projects/ArloarLoLs/2934080

Offline

 

Board footer