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

#1 2011-01-25 13:37:35

the_storm_of_stone
Scratcher
Registered: 2011-01-22
Posts: 24

Two questions...

Yes, I'm completely new. Please don't ridicule me for not being as intelligent as you are in using Scratch  smile

I want to make a 2D platformer, BUT, I don't know how to make it scroll, and I don't know how to script sensor sprites properly. When I tried the one on Scratch Wiki, my character was flung away from it and I couldn't move. I didn't actually understand it.  sad
I understand that you need these sensor sprites to collide with walls and ceilings without going through them, but do they help with falling through the floor whenever the down key is pressed?

Can anyone help me with these things?

Offline

 

#2 2011-01-25 13:40:20

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Two questions...

Here is a tutorial in the Scratch Wiki. It holds lots of answers!  smile 
Scratch On!

Offline

 

#3 2011-01-25 13:47:25

the_storm_of_stone
Scratcher
Registered: 2011-01-22
Posts: 24

Re: Two questions...

Yeah, I read through this one, but I need to know how to make the sensor sprites work first. I really need to know what they mean by "four different terrains", and how to create the effect of gravity, (which I think I've already done anyway...)

Offline

 

#4 2011-01-25 13:54:48

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Two questions...

the_storm_of_stone wrote:

Yeah, I read through this one, but I need to know how to make the sensor sprites work first. I really need to know what they mean by "four different terrains", and how to create the effect of gravity, (which I think I've already done anyway...)

the sensor: okay on your sprite, you color a different color on the edge of each side. e.g.     
       ___________________
       |                          |
       |                          |
       |                          |
       |                          |
        ---------------------------

This is your sprite. there is a color colored on the edge of each side.
Then you make code that says 'if touching color green {  }'

Last edited by ProgrammingFreak (2011-01-25 13:55:09)

Offline

 

#5 2011-01-25 14:22:12

the_storm_of_stone
Scratcher
Registered: 2011-01-22
Posts: 24

Re: Two questions...

Yeah, I've managed to get that, but I don't know how you can get the "hitTest" and the left/right/up/down hittest in the  "of" sensor block...

Offline

 

#6 2011-01-25 18:31:15

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

Re: Two questions...

the_storm_of_stone wrote:

Yeah, I've managed to get that, but I don't know how you can get the "hitTest" and the left/right/up/down hittest in the  "of" sensor block...

Oh, that's only if your hit test variables were defined as local. (Usable only by your sensor sprite.) Chances are, you made then global, (that's the default) so you can just find them under the variables list.


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

Offline

 

#7 2011-01-26 00:36:50

the_storm_of_stone
Scratcher
Registered: 2011-01-22
Posts: 24

Re: Two questions...

But the tutorial says that it has to be on the actual player sprite not the sensor sprite. I made the tests only for the character sprite, but they still don't show up on the drop-down, and how am I meant to apply the hitTest variable when the sensor sprite uses it too?

Offline

 

#8 2011-01-26 11:13:22

the_storm_of_stone
Scratcher
Registered: 2011-01-22
Posts: 24

Re: Two questions...

I tried the tutorial in an entirely new project, and it scrolled okay but the player sprite would't jump and collisions weren't detected with the walls.
I made the first () of the () of () block a variable from the local ones I had attached to the player, but nothing would show up in the second (). Also, how would the hitTest work for the sensor sprite and the player at the same time, if I have to make the hitTest only for the player?   
I'm really confused  sad

Offline

 

#9 2011-01-26 14:31:02

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

Re: Two questions...

All the controls and sensing are generally located on the sensor sprite, and the player sprite just changes costumes and goes to the position of the sensor.


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

Offline

 

#10 2011-01-26 14:44:28

the_storm_of_stone
Scratcher
Registered: 2011-01-22
Posts: 24

Re: Two questions...

Ah, yes, I got the sensor set to look like the example, but another problem for me now is the terrain scrolling. I'm pretty sure I coded it right...
The issue is, is that when I start up the scripts, the terrain glides up to the top of the stage... Does the terrain have to fill the whole stage?

Offline

 

Board footer