xykon wrote:
ive tried experimenting with different things,and cannot figure it out for my game.
thanks,
xykon
1. put very small diferent color dots on all 4 sides of your sprite.
2. put the script: when green flag pressed, forever if color (your color on top) is touching (your wall color), change y by -1
when it his a wall, it should back away so you can't go through it!
tell me if it works!
Last edited by techdoodle (2011-10-28 17:30:18)
Offline
Here’s the tip, it’s not the wall.
It’s kind of complicated to do this.
What you have to do is duplicate the player sprite.
Lets say your player is a square.
You want to duplicate the sprite, remove ALL of the scripts (in the second sprite), and redesign the costume to look something like this.
Just make sure the blue is on the right, red is on the left, and yellow is facing upward.
For the sensor sprite (the second one) use this script: (assuming that the color of the ground is green)
And if you are using the simple movement script, I’d use these scripts for the player sprite:
Tell me if you are doing anything different, like if the player uses velocity scripting, or if the player isn’t a square.
Offline
Here, you can try saying something of this nature in your wall sprite:
First create two layers, one with vertical walls and one with horizontal ones, the put in this code.
When Green Flag Clicked
Forever
if <touching |Player|>
repeat until <not touching |Player|>
//for vertical
go to x: ((xposition) + (1)) y: ((yposition))
//for vertical
go to x: ((xposition)) y: ((yposition) + (1))
I hope this helped, in theory it should work, but let me know if you have any problems.
Offline
astroLoger wrote:
Here, you can try saying something of this nature in your wall sprite:
First create two layers, one with vertical walls and one with horizontal ones, the put in this code.
When Green Flag Clicked
Forever
if <touching |Player|>
repeat until <not touching |Player|>
//for vertical
go to x: ((xposition) + (1)) y: ((yposition))
//for vertical
go to x: ((xposition)) y: ((yposition) + (1))
I hope this helped, in theory it should work, but let me know if you have any problems.
The second vertical should be horizontal.
Man, I hate how the blocks messed my carefully typed code up.
henley, you beat me by 10 seconds?!?
Offline
iTweak0r wrote:
henley wrote:
You changed the block it's repeat () not repeat () times
You have a keen eye. Usually, people don't notice that.
But I hacked my version of Scratch. I made a bunch of new scripts, changed the wording to some of the original blocks, and replaced the logo and a few other minor changes.
Offline