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

#1 2012-04-22 06:33:00

RogueDream01
New Scratcher
Registered: 2012-02-12
Posts: 9

I need help with moving away if touching walls!

Im making an rpg style exploration game with a birds eye view, the background is just color, and the actual map is a sprite, if the 'hero' the players control touches it, it dissapears under it, I need to find a way to make the hero rebound away from the wall, can anybody help me???

Offline

 

#2 2012-04-22 06:47:17

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: I need help with moving away if touching walls!

Assuming that your map sprite has gaps for the floor or whatever you could do:

If touching mapsprite
point in direction 180 - current direction (or maybe the other way around)
move 10 steps
end


And that might work.

Offline

 

#3 2012-04-22 07:01:49

RogueDream01
New Scratcher
Registered: 2012-02-12
Posts: 9

Re: I need help with moving away if touching walls!

Thanks, it works perfectly when I touch the left side, but quickly slides under the right side.

Offline

 

#4 2012-04-22 09:06:27

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: I need help with moving away if touching walls!

If it's on the left side, change x by -10. Create color sensors on the map to tell what is left and whatis right.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#5 2012-04-22 09:25:55

RogueDream01
New Scratcher
Registered: 2012-02-12
Posts: 9

Re: I need help with moving away if touching walls!

Thanks again!

Offline

 

#6 2012-04-24 01:16:53

Jem12
Scratcher
Registered: 2012-04-20
Posts: 100+

Re: I need help with moving away if touching walls!

hmm I didn't really Read anything....  sad  Sorry but if it's the edge of the screen your talking about then add in the "If on edge bounce" script but if its an RPG and your falling through something on the side??? I don't think I can help you with that  sad

cool


"In the begging the universe was created, this made a lot of people angry and was widly regarded as a bad move" ~  Douglas Adams ~ The resturant at the end of the universe

Offline

 

#7 2012-04-24 11:12:44

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: I need help with moving away if touching walls!

My game has the same problem, but I have a script that fixed it... download it if you need to.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

Board footer