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

#1 2010-11-05 16:50:12

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Solid objects

I've made a project from Wolfie1996's Any direction scrolling project and I was wondering how I would make a solid object. I've tried quite a few different things but I can't work out how to do it. My object is a sprite.


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#2 2010-11-06 07:57:53

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Solid objects

Bump


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#3 2010-11-06 08:31:51

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: Solid objects

Maybe this post/topic can help?


http://i51.tinypic.com/20gcn5j.png

Offline

 

#4 2010-11-06 08:34:41

recycle49
Scratcher
Registered: 2009-12-21
Posts: 1000+

Re: Solid objects

I dont understand what you need.


"Every challenge must be met, every battle must be won, and every story will end." -Me
Recycle49 December 09 - November 11 Goodbye

Offline

 

#5 2010-11-06 12:22:36

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Solid objects

recycle49 wrote:

I dont understand what you need.

Well, I've got my main character (a chicken) and he is looking round a house. I'm trying to put some furniture into the house but I don't want my chicken to walk through the furniture.

JeanTheFox wrote:

Maybe this post/topic can help?

The problem is, I still want the chicken to be able to move after he's crashed into the furniture.

Last edited by melikecheese (2010-11-07 13:43:38)


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#6 2010-11-07 07:18:48

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Solid objects

Bump


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#7 2010-11-07 07:31:26

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Solid objects

forever if: <touching furniture>
move -10 steps
_^


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#8 2010-11-07 07:36:26

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Solid objects

Hardmath123 wrote:

forever if: <touching furniture>
move -10 steps
_^

But I need him to stay in the center of the screen.

Last edited by melikecheese (2010-12-06 12:43:10)


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#9 2010-11-07 13:11:15

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Solid objects

Okay, so this might take a little explaining, but definitely can be done. Have you ever used sensor sprites? They look like this:
http://i54.tinypic.com/hsrqtz.jpg
Notice that each side is a different color. That way, you can distinguish between left, right, up, and down. Now, you need your script. The sensor sprite has a ghost effect of 100, and it controls all movement. (The visible sprite, in this case a chicken, only moves to its position.)

Now you need to make it so the sprite won't move if it's pushing against an immovable object. Obviously, you can't restrict all movement if it's touching the terrain anywhere, because then you couldn't move away. So you need to restrict, for example, forward movement if the front of the sprite is touching an obstacle. In that case, the script would be:

Code:

When green flag clicked
Forever
   If < <key up pressed > and not < <color (color on top) is touching color (color of obstacle)> > >
      change y by 5
   EndIf
EndForever

(Note here that the obstacle sprite is a solid color, and also has its ghost effect set to 100)

Then adapt that script for the other 3 directions. Make sense?


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#10 2010-11-07 13:24:35

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Solid objects

melikecheese wrote:

recycle49 wrote:

I dont understand what you need.

Well, I'e got my main character (a chicken) and he is looking round a house. I'm trying to put some furniture into the house but I don't want my chicken to walk through the furniture.

JeanTheFox wrote:

Maybe this post/topic can help?

The problem is, I still want the chicken to be able to move after he's crashed into the furniture.

Do you want the chicken to, say, be able to move left, right and down, but not up if it hit the furnishing on it's top?

EDIT: Never mind, Harakou explained it.

Last edited by ScratchReallyROCKS (2010-11-07 13:25:45)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#11 2010-11-07 13:53:07

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Solid objects

Harakou wrote:

Okay, so this might take a little explaining, but definitely can be done. Have you ever used sensor sprites? They look like this:
http://i54.tinypic.com/hsrqtz.jpg
Notice that each side is a different color. That way, you can distinguish between left, right, up, and down. Now, you need your script. The sensor sprite has a ghost effect of 100, and it controls all movement. (The visible sprite, in this case a chicken, only moves to its position.)

Now you need to make it so the sprite won't move if it's pushing against an immovable object. Obviously, you can't restrict all movement if it's touching the terrain anywhere, because then you couldn't move away. So you need to restrict, for example, forward movement if the front of the sprite is touching an obstacle. In that case, the script would be:

Code:

When green flag clicked
Forever
   If < <key up pressed > and not < <color (color on top) is touching color (color of obstacle)> > >
      change y by 5
   EndIf
EndForever

(Note here that the obstacle sprite is a solid color, and also has its ghost effect set to 100)

Then adapt that script for the other 3 directions. Make sense?

Thank you, but how would I put that into Wolfie1996's project? It's hard to explain, so maybe have a look at her project.


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#12 2010-11-07 13:56:34

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Solid objects

melikecheese wrote:

Harakou wrote:

Okay, so this might take a little explaining, but definitely can be done. Have you ever used sensor sprites? They look like this:
http://i54.tinypic.com/hsrqtz.jpg
Notice that each side is a different color. That way, you can distinguish between left, right, up, and down. Now, you need your script. The sensor sprite has a ghost effect of 100, and it controls all movement. (The visible sprite, in this case a chicken, only moves to its position.)

Now you need to make it so the sprite won't move if it's pushing against an immovable object. Obviously, you can't restrict all movement if it's touching the terrain anywhere, because then you couldn't move away. So you need to restrict, for example, forward movement if the front of the sprite is touching an obstacle. In that case, the script would be:

Code:

When green flag clicked
Forever
   If < <key up pressed > and not < <color (color on top) is touching color (color of obstacle)> > >
      change y by 5
   EndIf
EndForever

(Note here that the obstacle sprite is a solid color, and also has its ghost effect set to 100)

Then adapt that script for the other 3 directions. Make sense?

Thank you, but how would I put that into Wolfie1996's project? It's hard to explain, so maybe have a look at her project.

You should be able to just convert the "Change y" block to yscroll...

Oh, right. The object. If you make all the objects in a 360 by 480 region one sprite, then you should be able to just use the same script that is in the terrain background sprite for that same region.

Last edited by Harakou (2010-11-07 13:59:19)


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#13 2010-11-07 14:24:19

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Solid objects

Harakou wrote:

melikecheese wrote:

Harakou wrote:

Okay, so this might take a little explaining, but definitely can be done. Have you ever used sensor sprites? They look like this:
http://i54.tinypic.com/hsrqtz.jpg
Notice that each side is a different color. That way, you can distinguish between left, right, up, and down. Now, you need your script. The sensor sprite has a ghost effect of 100, and it controls all movement. (The visible sprite, in this case a chicken, only moves to its position.)

Now you need to make it so the sprite won't move if it's pushing against an immovable object. Obviously, you can't restrict all movement if it's touching the terrain anywhere, because then you couldn't move away. So you need to restrict, for example, forward movement if the front of the sprite is touching an obstacle. In that case, the script would be:

Code:

When green flag clicked
Forever
   If < <key up pressed > and not < <color (color on top) is touching color (color of obstacle)> > >
      change y by 5
   EndIf
EndForever

(Note here that the obstacle sprite is a solid color, and also has its ghost effect set to 100)

Then adapt that script for the other 3 directions. Make sense?

Thank you, but how would I put that into Wolfie1996's project? It's hard to explain, so maybe have a look at her project.

You should be able to just convert the "Change y" block to yscroll...

Oh, right. The object. If you make all the objects in a 360 by 480 region one sprite, then you should be able to just use the same script that is in the terrain background sprite for that same region.

THANK YOU!


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

Board footer