Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SCREEN_WIDTH = 320
- SCREEN_HEIGHT = 480
- LIMIT_FPS = 30
- local player = {}
- player.x = SCREEN_WIDTH / 2
- player.y = SCREEN_HEIGHT / 2
- -- Disable the status bar
- display.setStatusBar(display.HiddenStatusBar)
- -- Add a background image
- local background = display.newImage ("background.png")
- local playerObject = display.newText("@", player.x, player.y, "Courier Final Draft", 24)
- playerObject:setTextColor(255, 255, 255)
- playerIsRed = false
- playerObject:addEventListener( "tap", playerObject)
- function playerObject:tap( event )
- if playerIsRed then
- playerObject:setTextColor(255, 255, 255)
- playerIsRed = false
- else
- playerObject:setTextColor(255, 0, 0)
- playerIsRed = true
- end
- end
- function playerMovement (event)
- playerObject.x = event.x
- playerObject.y = event.y
- end
- Runtime:addEventListener("touch", playerMovement)
Add Comment
Please, Sign In to add comment