Pages: 1
Topic closed
Now I'm doung a RPG game, and I want that the hero don't touch the houses an other thing, in photoshop I clear the walkable part to have the part that you cant walk trought.
I want to put at the if condition "Bounce"
thx
Offline
Depends on what you mean by "bounce". If you want to fake it a bit, you can just have the other sprite change direction by 180 degrees, maybe add in a little random variation just to keep it interesting. It won't look very realistic at low angles but it might do the trick.
Offline
If you mean that you don't want the player to run into walls, you can use sensing:
Have four sprites that follow the player, but are slightly above/below/left/right. Each one of them has to report back to the player whether they are touching a wall, and the player then decides whether to move in that direction or bounce off it.
Offline
I've got an idea on how to do that:
1) Drag on an "If Green Flag clicked" block and then you snap on a
"Forever" block.
2) Drag an "if" block into the forever block and then drag a "if touching color {}" block. Put the color of that sort of "object".
3) Then put on a "go to x: y:" block and snap on two "pick random from whatever to whatever" block. It's pretty straitforward from there. Good luck with the programming!
Offline
ok thanks evrybody...
To myschool i'm doing a scratch projet in rpg, a game, and i dont want to walk in the walls, i can't use colors, becouse there are very diferents, i mean samething like this but less complicate,
http://scratch.mit.edu/projects/Duning/1767878
Offline
Duning wrote:
ok thanks evrybody...
To myschool i'm doing a scratch projet in rpg, a game, and i dont want to walk in the walls, i can't use colors, becouse there are very diferents, i mean samething like this but less complicate,
http://scratch.mit.edu/projects/Duning/1767878
Oh, ok. So you cant't use colors. Hmm... *light bulb* I got it! You just make the color in the script thing gray, or black or maybe even white if the backround is like black or something.
Last edited by Wman3 (2011-05-06 11:47:36)
Offline
Duning wrote:
ok, and with colors how do i should do it?
There are multiple ways to go about it, some rather simple and some more complex. If you have flat, 90 degree walls and floors, you could make a sensor sprite to detect what type of wall (horizontal/vertical) that the player is touching, and react accordingly.
Offline
Look at this script: here.
This uses only the sprite you're moving, no sensor sprites or sensor colors needed.
Offline
Topic closed
Pages: 1