HI I’m making a shooting games! After I shoot the planes I want my explosion sprite images to play, but i don"t know what lines of codes to use to create this effect. please someone help???
Ok, assuming you have an explosion sprite sheet you would simply define it at the top of your code, and then play it when you are ready:
local options = {width = 200, height = 200, numFrames = 6, sheetContentWidth = 600, sheetContentHeight = 400} local sheet = graphics.newImageSheet("explosion.png", options) local sequenceData = {name = "explode", time = 800, loopCount = 1} --After plane is shot: local explosion = display.newSprite(sheet, sequenceData) explosion.x = plane.x explosion.y = plane.y explosion:play()
This is your first post, so I am assuming you are not familiar with the Corona Docs and Guides, these two info hubs contain a lot of information when it comes to Corona:
Ok, assuming you have an explosion sprite sheet you would simply define it at the top of your code, and then play it when you are ready:
local options = {width = 200, height = 200, numFrames = 6, sheetContentWidth = 600, sheetContentHeight = 400} local sheet = graphics.newImageSheet("explosion.png", options) local sequenceData = {name = "explode", time = 800, loopCount = 1} --After plane is shot: local explosion = display.newSprite(sheet, sequenceData) explosion.x = plane.x explosion.y = plane.y explosion:play()
This is your first post, so I am assuming you are not familiar with the Corona Docs and Guides, these two info hubs contain a lot of information when it comes to Corona: