how can I make an object make jump and move?eg.I want my frog to jump and move?hows is this possible?Please help me if anybody can? [import]uid: 45566 topic_id: 25000 reply_id: 325000[/import]
What parts do you have done already?
Your first step would be to get the character moving left and right, is that done? If not check out the d-pad tutorial on Techority for a start.
Are you using physics? That will have an impact on how you should control the jump, obviously
[import]uid: 52491 topic_id: 25000 reply_id: 101549[/import]
[lua]local character = display.newImage(“frog.png”)
character.name = “Frog”
physics.addBody(character,{friction = 1.0,bounce = 0,density = 1})
character.isFixedRotation = true
local xMovement
local yMovement
local function move_var(event)
xMovement = -event.xGravity * 50
yMovement = -event.yGravity * 50
end
Runtime:addEventListener(“accelerometer”,move_var)
local function movement(event)
character.x = character.x + YMovement
end
Runtime:addEventListener(“enterFrame”,movement)
local function onScreenTouch(event)
if event.phase == “began” then
character:applyLinearImpulse(100,-200,character.x,character.y)
end
return true
end
background:addEventListener(“touch”,onScreenTouch)[/lua]
I have made my character to move left and right using accelerometer.But this is not going the way i want.This is not giving me the feel of frog jump.Can you help me out please… [import]uid: 45566 topic_id: 25000 reply_id: 101567[/import]
please help me out…this i code has given me the effect of jump and move But i want to get the real effect of the frog movement…please help me out…
[import]uid: 45566 topic_id: 25000 reply_id: 101814[/import]
You might want to look at using a transition and easing, possibly. I’m not really sure what a frog jump looks like but if it isn’t one consistent speed then that is one option. [import]uid: 52491 topic_id: 25000 reply_id: 101831[/import]