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

#1 2007-12-20 18:23:27

Pikachanian
Scratcher
Registered: 2007-10-25
Posts: 22

Don't get why your project is not working?

http://scratch.mit.edu/projects/Pikachanian/70223


Hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi @:0
(Look at the end of it to see Elvis.)
I'm only 11, and I have an IQ of 124! According to 3 different tests!

Offline

 

#2 2007-12-20 19:50:59

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Don't get why your project is not working?

Sorry, is that project one you wanted help with?  What exactly did you  want to have happen, and what happens instead?

Offline

 

#3 2007-12-22 11:45:13

Pikachanian
Scratcher
Registered: 2007-10-25
Posts: 22

Re: Don't get why your project is not working?

it  is supposed to be able to fall through platforms that are "behind" it but land on platforms that are not.


Hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi @:0
(Look at the end of it to see Elvis.)
I'm only 11, and I have an IQ of 124! According to 3 different tests!

Offline

 

#4 2007-12-22 13:36:01

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Don't get why your project is not working?

How is your sprite detecting whether it is in front of or behind platforms?  I thought that scratch did not have any way of detecting which layer sprites were on.

Offline

 

#5 2007-12-27 13:00:03

Pikachanian
Scratcher
Registered: 2007-10-25
Posts: 22

Re: Don't get why your project is not working?

each sprite has a "z axis" that controls size and what layer it is on.


Hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi @:0
(Look at the end of it to see Elvis.)
I'm only 11, and I have an IQ of 124! According to 3 different tests!

Offline

 

#6 2007-12-27 17:16:00

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Don't get why your project is not working?

OK, I downloaded your program to look at the code.  The trouble is that you have 4 different scripts all telling the sprite how to move.  Having one say move up while the other 3 say move down is not likely to do the right thing.

Perhaps you should try having only one script do movement.

I tried simplifying your code:

when greenflag clicked
   set moveup to 0
   forever
      if  moveup>0
          change y by 2
      else
          change y by -2

The 4 scripts like

when greenflag clicked
forever if  touching sprite2 and (cz=p1 zaxis or cz < p1 zaxis)
    set moveup to 1

and one more script to turn things off

when greenflag clicked
forever if not (touching sprite2 or touching sprite3 or touching sprite4 or touching sprite5)
   set moveup to 0



This is not the way I would have coded the task, but it is as close as I could get to what you started from.  It seems to work.

It might be more efficient to add
    wait until moveup < 1
after each of the "set moveup to 1" blocks.

Also, in v1.2.1 you don't need global variables for all the z-axis variables.  Just give each sprite it's own "z" variable and use the sensing block to look at "sprite2's z".  That will make the code much clearer, particularly if you first give the sprites meaningful names (cat, top platform, ...).

Offline

 

#7 2007-12-29 09:13:48

Pikachanian
Scratcher
Registered: 2007-10-25
Posts: 22

Re: Don't get why your project is not working?

Thanks! I fixed by making it a single script and now it works!


Hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi @:0
(Look at the end of it to see Elvis.)
I'm only 11, and I have an IQ of 124! According to 3 different tests!

Offline

 

Board footer