Hi im new to this forum and to corona but my question is how do i animate my player using sprite sheets? I’ve used the texture packer and got the .lua file and the .png files to my folder where my game is but im confused on how to set it up with my controls for my player. I’ll post my code down below. Keep in mind im very new to corona so please dont be to harsh lol. Thank you.
display.setStatusBar( display.HiddenStatusBar ) local physics = require("physics") physics.start() --physics.setDrawMode("hybrid") local sheetInfo = require("spritesheet") motionx = 0; speed = 5 local background = display.newImageRect("Images/background.png", 480, 320) background.x = 240 background.y = 160 local floor = display.newRect(0, 320, 960, 120) floor.alpha = 0 physics.addBody(floor, "static", {friction=0.5, bounce =0.3}) local player = display.newImageRect("Images/player.png", 100, 100) player.x = 50 player.y = -200 physics.addBody(player, "dynamic", {friction=0.5, bounce=0.3}) local left = display.newCircle(0, 25, 25) left.x = 50; left.y = 280; left.alpha = 0.3 --Add right joystick button local right = display.newCircle(0, 25, 25) right.x = \_W -50; right.y = 280; right.alpha = 0.3 -- character left function left:touch() motionx = -speed; end left:addEventListener( "touch", left ) function right:touch() motionx = speed; end right:addEventListener( "touch", right ) --Move character local function movePlayer(event) player.x = player.x + motionx; end Runtime:addEventListener( "enterFrame", movePlayer ) --Stop character local function stop (event) if event.phase == "ended" then motionx = 0; end end Runtime:addEventListener("touch", stop)