working on bowling demo
git-svn-id: svn://anubis/anaglym/trunk@209 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
bf2485ced5
commit
2aee3daba6
@ -72,14 +72,41 @@ function init_event()
|
||||
resetPins()
|
||||
setupStars()
|
||||
setupScore()
|
||||
ag.setCamera(0, -10, 5, 0, 20, 0)
|
||||
position_x = 0
|
||||
target_x = 0
|
||||
game_state = "waiting"
|
||||
last_update_time = ag.elapsedTime()
|
||||
end
|
||||
|
||||
function update_event()
|
||||
ag.setCamera(position_x, -10, 5, target_x, 20, 0)
|
||||
local now = ag.elapsedTime()
|
||||
if (ag.isKeyDown("a") or ag.isKeyDown("left")) then
|
||||
position_x = position_x - (now - last_update_time) / 300
|
||||
if (position_x < -2) then
|
||||
position_x = -2
|
||||
end
|
||||
end
|
||||
if (ag.isKeyDown("d") or ag.isKeyDown("right")) then
|
||||
position_x = position_x + (now - last_update_time) / 300
|
||||
if (position_x > 2) then
|
||||
position_x = 2
|
||||
end
|
||||
end
|
||||
last_update_time = now
|
||||
|
||||
ag.callList(stars)
|
||||
end
|
||||
|
||||
function mouse_motion_event(x, y, xrel, yrel)
|
||||
target_x = target_x + xrel / 100
|
||||
if (target_x < -2) then
|
||||
target_x = -2
|
||||
elseif (target_x > 2) then
|
||||
target_x = 2
|
||||
end
|
||||
end
|
||||
|
||||
function drawFrameScore(width, height, frame, fs)
|
||||
local size = 60
|
||||
local ball_size = 24
|
||||
@ -146,6 +173,8 @@ end
|
||||
function launchBall()
|
||||
game_state = "launched"
|
||||
launch_time = ag.elapsedTime()
|
||||
bowling_ball = reference_ball:clone()
|
||||
bowling_ball:setPosition(position_x, -10, 4)
|
||||
end
|
||||
|
||||
function drawPowerBar(width, height)
|
||||
|
Loading…
x
Reference in New Issue
Block a user