The code isnt complete but this might help you enough to get started, I’ll try to work on it when I can again, got home at 5;33 this morning so I only got to work on it a few hours later when I woke up a little. I could only look at the amazing trailer for that game and not play it since I dont have any device so let me know what changes you would like for it and what’s not the way you’d want. Also note that I dont have time to clean up the code Im really sorry for the inconvenience but i thought itd be better to post it now instead of 12 hours later or whenever I get home. Ill clean it up and work on it more so it work closers to what you want, just gimme some feedback and hope you understand it, let me know if you need anything or any explanation.
[code]
local spawnTrue = true;
display.setStatusBar( display.HiddenStatusBar )
local physics = require “physics”
physics.start()
physics.setDrawMode ( “hybrid” )
–physics.setDrawMode ( “normal” )
physics.setGravity( 0, 0 )
system.activate( “multitouch” )
local leftwall = display.newRect(0, 0, 1, display.contentHeight )
local rightwall = display.newRect( display.contentWidth, 0, 1, display.contentHeight )
local ceiling = display.newRect( 0, 0, display.contentWidth, 1 )
physics.addBody(leftwall, “static”, { bounce = 0.1 } )
physics.addBody(rightwall, “static”, { bounce = 0.1 } )
physics.addBody(ceiling, “static”, { bounce = 0.1 } )
local ground = display.newRect( 0, 0, 320, 50)
ground:setReferencePoint( display.BottomLeftReferencePoint )
ground.x, ground.y = 0, 540
– local groundShape = { -240,-20, 240,-20, 240,20, -240,20 }
– local ground = display.newRect( 100, 100, 0, 0 )
physics.addBody( ground, “static” )
movez = 0
local myText = display.newText("", 150, 150, native.systemFont, 16)
local player = display.newRect( 150, 150, 50, 50 )
physics.addBody( player, “dynamic” )
player.myName = “player”
local function stopPlayer()
player:setLinearVelocity(0, 0)
end
local function movePlayer( event )
movex = event.x
movey = event.y
movetx = event.x - player.x
movety = event.y - player.y
vmax = 100
– movez^2 = movetx^2 + movety^2
moves = (movetx*movetx + movety*movety)
sfactor = (vmax^2/moves)^0.5
velx = movetx * sfactor
vely = movety * sfactor
travelTime = 1000 * (moves^0.5)/100
move1 = math.pow(movetx, 2)
move2 = math.pow(movety, 2)
movez = math.sqrt(move1 + move2)
testx = player.x - movetx
testy = player.y - movety
myText.text = movez
player:setLinearVelocity(velx*3, vely*3);
if event.phase == ‘ended’ then
stopPlayer()
end
– if event.phase == “moved” then
– transition.to( player, { time=travelTime, x=movex, y=movey } )
– end
end
Runtime:addEventListener( “touch”, movePlayer )
[/code] [import]uid: 77199 topic_id: 24699 reply_id: 100401[/import]