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

#1 2011-10-28 17:07:36

xykon
New Scratcher
Registered: 2011-09-20
Posts: 6

how do you make walls "solid"

ive tried experimenting with different things,and cannot figure it out for my game.
thanks,

xykon

Offline

 

#2 2011-10-28 17:28:15

techdoodle
Scratcher
Registered: 2010-10-08
Posts: 21

Re: how do you make walls "solid"

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)


http://i.picasion.com/pic48/ee5dbb3c993d0986e1efcd07168078ad.gif Click to play!

Offline

 

#3 2011-10-28 17:53:07

xykon
New Scratcher
Registered: 2011-09-20
Posts: 6

Re: how do you make walls "solid"

sorry, i tried it and it didn't work

Offline

 

#4 2011-10-28 18:00:10

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: how do you make walls "solid"

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.

http://i39.tinypic.com/nv1gtz.gif
You want to duplicate the sprite, remove ALL of the scripts (in the second sprite), and redesign the costume to look something like this.

http://i42.tinypic.com/a2gho9.gif
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)
http://i40.tinypic.com/mju8f5.gif

And if you are using the simple movement script, I’d use these scripts for the player sprite:
http://i39.tinypic.com/30kzrc2.gif

Tell me if you are doing anything different, like if the player uses velocity scripting, or if the player isn’t a square.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#5 2011-10-28 18:10:50

astroLoger
New Scratcher
Registered: 2011-10-16
Posts: 100+

Re: how do you make walls "solid"

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

 

#6 2011-10-28 18:15:30

astroLoger
New Scratcher
Registered: 2011-10-16
Posts: 100+

Re: how do you make walls "solid"

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

 

#7 2011-10-28 19:46:49

iTweak0r
Scratcher
Registered: 2011-07-30
Posts: 100+

Re: how do you make walls "solid"

henley wrote:

http://i39.tinypic.com/30kzrc2.gif

You changed the block it's repeat () not repeat () times


Make it in Scratch! because it's cooler when it's made in scratch
http://i.imgur.com/D4iqPHR.png

Offline

 

#8 2011-10-28 22:01:02

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: how do you make walls "solid"

iTweak0r 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.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

Board footer