Hey there,
I glanced at the code you zipped. If I understand the game design, the user clicks on the appropriate color blob matching the scissor color (as written in the Instructions). If the choice/colors match, the sheep “jumps” right before the scissors reach him. Is that correct?
If so, a sensor is a good option. You just place it below (or above) the sheep, but you set it as invisible during game play:
local jumpTrigger = display.newRect( sheep.x, sheep.y, 100, 100 )
jumpTrigger:setFillColor( 255, 0, 0, 50 )
--jumpTrigger.isVisible = false --un-comment this later to make this sensor invisible
physics.addBody( jumpTrigger, { isSensor = true } )
jumpTrigger.bodyType = "kinematic"
jumpTrigger.collision = sheepJump --the function to call when the sensor is "activated"
jumpTrigger:addEventListener( "collision", jumpTrigger )
Somewhere above that in your code, you write the jump function:
local function sheepJump( self, event )
-- do whatever here. "self" is the sensor. "event.other" specifies the scissors, or whatever collided with the sensor
end
This should work, but I haven’t tested it. I just hacked out this basic code and there might be some errors, but this is the basic idea. Obviously you can adjust the numbers and positioning of the sensor and whatever else.
You might also need to define the proper Collision Groups for the sensor and the scissors. All of that is detailed in the Collisions section of the Corona documentation.
Let me know if that helps,
Best of luck!
Brent
[import]uid: 9747 topic_id: 2732 reply_id: 8282[/import]