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

#1 2007-07-19 21:09:42

corbjop
Scratcher
Registered: 2007-06-13
Posts: 14

back!

im making a game with a overhead/birdseye view and i cant figure out that when he touches the coulor(of the wall) he goes backwards so they dont walk on those parts if you want to see what i mean search zelda demo i downloaded it but couldnt figur it out. please help thanx

Offline

 

#2 2007-07-20 17:45:39

pedroskivich
Scratcher
Registered: 2007-05-21
Posts: 72

Re: back!

Say

when green flag clicked for ever if sensing (color) Turn sprite one 180 degrees move # steps.

Offline

 

#3 2007-07-21 02:46:05

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: back!

There are 2 methods.

One is to after moving to see if you are touching the wall, and if so move backwards until you are not.  This often works well but can look flickery when used in platform games versus gravity.

The second is to use a sensor (a tiny coloured dot) attached to your sprite that checks whether the move is valid before it takes place, and only allows the move if it is into a clear space. 
FOREVER
--IF {{ up arrow pressed} AND {colour x touching colour y}}
----Move forward 10

A demo can be seen in the bacman game that comes with scratch.  This is my prefered method.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#4 2007-07-22 22:50:04

corbjop
Scratcher
Registered: 2007-06-13
Posts: 14

Re: back!

thanks

Offline

 

#5 2008-06-02 19:49:25

Robobob
Scratcher
Registered: 2007-06-03
Posts: 7

Re: back!

Im trying to make an overhead view but I don't know how to make it rotate with my guy.
I have tried this but it don't work [blocks]<when[ right ]key pressed><turn cw( 15 )degrees>[/blocks] sad

Offline

 

Board footer