In the Air Hockey 2 sample game template, I merely switched the order of when the Paddles & Puck are placed in the game with dramatic results.
Bug: The game still functioned, but I was surprised to see a score was recorded for a puck only half way to the goal.
Question: why does it behave this way? Is this behavior a bug using using build 2011.591?
[lua]-- As Downloaded Air Hockey 2 sample Code:
function startGame(event)
titleScreenGroup:removeSelf()
resetScore() – in the case that this is a rematch
– Paddles placed first
placePlayerOnePaddle()
placePlayerTwoPaddle()
– Puck placed Second
placePuck(puckAvalLocation.center)
Runtime:addEventListener( “postCollision”, onPostCollision )
Runtime:addEventListener( “collision”, onCollision )
end[/lua]
[lua]-- Modified ONLY the order of the Puck & Paddle placement function calls in the
– startGame() function.
– Modified code below:
function startGame(event)
titleScreenGroup:removeSelf()
resetScore() – in the case that this is a rematch
– Puck placed first, instead of placePaddles first
placePuck(puckAvalLocation.center)
– Paddles placed Second, instead of Puck placed second
placePlayerOnePaddle()
placePlayerTwoPaddle()
Runtime:addEventListener( “postCollision”, onPostCollision )
Runtime:addEventListener( “collision”, onCollision )
end[/lua]
Switch these 2 sets of function calls (placePuck & placePlayer(One & Two)Paddle) around yourself in the Air Hockey 2 template and give it a try.
http://developer.anscamobile.com/code/air-hockey-2-player-game
Thank you!
-David
[import]uid: 53538 topic_id: 15603 reply_id: 315603[/import]