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

#1 2012-06-20 10:56:27

dankill51
Scratcher
Registered: 2012-01-22
Posts: 85

Walking and Jumping

I'm making a 2d version of Minecraft and I don't know what's wrong with the walking and jumping scripts. They work for one block that I made but when I duplicate the block the player falls through it. Can someone download it and try to see whats wrong? Thanks.

Link:   scratch.mit.edu/projects/dankill51/2623586

Offline

 

#2 2012-06-20 11:28:49

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Walking and Jumping

The problem is you have conflicting scripts if you do that...you have one sprite saying it's touching the ground and the other one saying it isn't.  Overall, that means nothing is because they're using the same variable. Here's what I would do:

-Make a list called "b-touch"
-For each new block you make, add an item to the list and change the item that the block sets to the latest length of the list (i.e. if you have 4 blocks, block one replaces item (1) and block two replaces item (2). etc.)
-have the character sprite contain this script:

when gf clicked
forever
set [ground? v] to <[b-touch v] contains (1)?> //or whatever means it's touching the character
-instead of testing for 1 or 0, test for "true" or "false".  "true" means it is touching, "false" not.

Hope that helps!


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-06-20 11:34:08

dankill51
Scratcher
Registered: 2012-01-22
Posts: 85

Re: Walking and Jumping

Thanks! I'll try that now

Offline

 

#4 2012-06-20 11:52:01

dankill51
Scratcher
Registered: 2012-01-22
Posts: 85

Re: Walking and Jumping

I'm confused on how to add an item to the list and change the item that the block sets to the latest length of the list for each new block I make, and should I take out any scripts or just add these?

Offline

 

#5 2012-06-20 11:56:28

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Walking and Jumping

dankill51 wrote:

I'm confused on how to add an item to the list and change the item that the block sets to the latest length of the list for each new block I make, and should I take out any scripts or just add these?

Here, I'll download and make the changes so it's less confusing  smile

EDIT: Here you go!

Last edited by AtomicBawm3 (2012-06-20 12:05:05)


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#6 2012-06-20 12:04:13

dankill51
Scratcher
Registered: 2012-01-22
Posts: 85

Re: Walking and Jumping

Thanks  smile

Offline

 

Board footer