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

#1 2012-05-08 06:04:41

RoguePhantom01
Scratcher
Registered: 2012-04-05
Posts: 100+

I need help with sprites getting stuck in ground?

I need help you guys, im making a platformer with colour sensors, but if the sprite the player is controlling falls from a distance, half of the sprite is buried in the ground, still able to move side to side, but partly buried. Any help please?


http://i1273.photobucket.com/albums/y404/orangetelephone/sig2.jpg

Offline

 

#2 2012-05-08 12:40:16

ManaUser
Scratcher
Registered: 2009-03-11
Posts: 100+

Re: I need help with sprites getting stuck in ground?

How about something like this?

when gf clicked
forever if <[#ff0000] touching [#00ff00] ?> //where red is bottom-sensor and green in ground.
change y by (1)
end

Last edited by ManaUser (2012-05-08 12:41:28)


http://i.imgur.com/SPYSM.gif http://i.imgur.com/t9k1Z.gif http://i.imgur.com/OwYVa.gif http://i.imgur.com/0qlZq.gif

Offline

 

#3 2012-05-09 13:24:33

RoguePhantom01
Scratcher
Registered: 2012-04-05
Posts: 100+

Re: I need help with sprites getting stuck in ground?

I tried something like that, but it didn't work.


http://i1273.photobucket.com/albums/y404/orangetelephone/sig2.jpg

Offline

 

#4 2012-05-09 14:20:12

FINGINtest
Scratcher
Registered: 2012-03-26
Posts: 20

Re: I need help with sprites getting stuck in ground?

make sensor costume slightly closer and instead of 1 Y try 3 Y or something.

Offline

 

#5 2012-05-10 07:58:28

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: I need help with sprites getting stuck in ground?

Just use this:

when gf clicked
forever
 if <key [right arrow v] pressed?>
  change [xvel v] by (1)
 end
 if <key [left arrow v] pressed?>
  change [xvel v] by (-1)
 end
 set [xvel v] to ((xvel) * (.87))
 change x by (xvel)
 if <touching [level v]?>
  change y by (([abs v] of (xvel)) + (1))
  if <touching [level v]?>
   change y by ((0) - (([abs v] of (xvel)) + (1)))
   change x by ((0)-(xvel))
   set [xvel v] to ((xvel) / (2))
  end
 end  
 if <key [up arrow v] pressed?>
  change y by (-1)
  if <touching [level v]?>
   set [yvel v] to (10)
  end
  change y by (1)
 end
 if <(yvel) < [3]>
  change y by (-1)
  if <not<touching [level v]?>>
   change [yvel v] by (-1)
  end
  change y by (1)
 end
 set [yvel v] to ((yvel) * (0.9))
 change y by (yvel)
 if <touching [level v]?>
  change y by ((0) - (yvel))
  set [yvel v] to ((yvel) / (2.5))
 end
end
I use it for a lot of my projects and it is really helpful.

Offline

 

#6 2012-05-10 14:16:20

theguy211
Scratcher
Registered: 2011-11-18
Posts: 53

Re: I need help with sprites getting stuck in ground?

Weegee!

Offline

 

Board footer