Help With Endless Runner, Sprite Won't Appear

Hi,

I’m using the tutorial from here http://mobile.tutsplus.com/tutorials/corona/build-an-endless-runner-game-from-scratch-using-sprites/

I added the sprite code on top of the background motion code and the backgrond moves and everything but the sprite is nowhere to be seen. Also I changed the original running monster in the tutorial to my own .png. Any suggestions?

&nbsp; --takes away the display bar at the top of the screen display.setStatusBar(display.HiddenStatusBar) &nbsp; --adds an image to our game centered at x and y coordinates local backbackground = display.newImage("images/background.png") backbackground.x = 240 backbackground.y = 160 &nbsp; local backgroundfar = display.newImage("images/bgfar1.png") backgroundfar.x = 480 backgroundfar.y = 160 &nbsp; local backgroundnear1 = display.newImage("images/bgnear2.png") backgroundnear1.x = 240 backgroundnear1.y = 160 &nbsp; local backgroundnear2 = display.newImage("images/bgnear2.png") backgroundnear2.x = 760 backgroundnear2.y = 160 &nbsp; --create a new group to hold all of our blocks local blocks = display.newGroup() &nbsp; --setup some variables that we will use to position the ground local groundMin = 420 local groundMax = 340 local groundLevel = groundMin local speed = 5; &nbsp; --this for loop will generate all of your ground pieces, we are going to --make 8 in all. for a = 1, 8, 1 do &nbsp;&nbsp;&nbsp;&nbsp;isDone = false &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;--get a random number between 1 and 2, this is what we will use to decide which &nbsp;&nbsp;&nbsp;&nbsp;--texture to use for our ground sprites. Doing this will give us random ground &nbsp;&nbsp;&nbsp;&nbsp;--pieces so it seems like the ground goes on forever. You can have as many different &nbsp;&nbsp;&nbsp;&nbsp;--textures as you want. The more you have the more random it will be, just remember to &nbsp;&nbsp;&nbsp;&nbsp;--up the number in math.random(x) to however many textures you have. &nbsp;&nbsp;&nbsp;&nbsp;numGen = math.random(2) &nbsp;&nbsp;&nbsp;&nbsp;local newBlock &nbsp;&nbsp;&nbsp;&nbsp;print (numGen) &nbsp;&nbsp;&nbsp;&nbsp;if(numGen == 1 and isDone == false) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newBlock = display.newImage("images/ground1.png") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isDone = true &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;if(numGen == 2 and isDone == false) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newBlock = display.newImage("images/ground2.png") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isDone = true &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;--now that we have the right image for the block we are going &nbsp;&nbsp;&nbsp;&nbsp;--to give it some member variables that will help us keep track &nbsp;&nbsp;&nbsp;&nbsp;--of each block as well as position them where we want them. &nbsp;&nbsp;&nbsp;&nbsp;newBlock.name = ("block" .. a) &nbsp;&nbsp;&nbsp;&nbsp;newBlock.id = a &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;--because a is a variable that is being changed each run we can assign &nbsp;&nbsp;&nbsp;&nbsp;--values to the block based on a. In this case we want the x position to &nbsp;&nbsp;&nbsp;&nbsp;--be positioned the width of a block apart. &nbsp;&nbsp;&nbsp;&nbsp;newBlock.x = (a \* 79) - 79 &nbsp;&nbsp;&nbsp;&nbsp;newBlock.y = groundLevel &nbsp;&nbsp;&nbsp;&nbsp;blocks:insert(newBlock) end &nbsp; --the update function will control most everything that happens in our game --this will be called every frame(30 frames per second in our case, which is the Corona SDK default) local function update( event ) &nbsp;&nbsp;&nbsp;&nbsp;--updateBackgrounds will call a function made specifically to handle the background movement &nbsp;&nbsp;&nbsp;&nbsp;updateBackgrounds() &nbsp;&nbsp;&nbsp;&nbsp;updateBlocks() &nbsp;&nbsp;&nbsp;&nbsp;speed = speed + .05 end &nbsp; &nbsp; &nbsp; function updateBlocks() &nbsp;&nbsp;&nbsp;&nbsp;for a = 1, blocks.numChildren, 1 do &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(a \> 1) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newX = (blocks[a - 1]).x + 79 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newX = (blocks[8]).x + 79 - speed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((blocks[a]).x \< -40) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(blocks[a]).x, (blocks[a]).y = newX, (blocks[a]).y &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(blocks[a]):translate(speed \* -1, 0) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;end end &nbsp; function updateBackgrounds() &nbsp;&nbsp;&nbsp;&nbsp;--far background movement &nbsp;&nbsp;&nbsp;&nbsp;backgroundfar.x = backgroundfar.x - (speed/55) &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;--near background movement &nbsp;&nbsp;&nbsp;&nbsp;backgroundnear1.x = backgroundnear1.x - (speed/5) &nbsp;&nbsp;&nbsp;&nbsp;if(backgroundnear1.x \< -239) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;backgroundnear1.x = 760 &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;backgroundnear2.x = backgroundnear2.x - (speed/5) &nbsp;&nbsp;&nbsp;&nbsp;if(backgroundnear2.x \< -239) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;backgroundnear2.x = 760 &nbsp;&nbsp;&nbsp;&nbsp;end end &nbsp; --this is how we call the update function, make sure that this line comes after the --actual function or it will no t be able to find it --timer.performWithDelay(how often it will run in milliseconds, function to call, --how many times to call(-1 means forever)) timer.performWithDelay(1, update, -1) &nbsp; &nbsp; &nbsp; --This should look familiar, hides the status bar from view display.setStatusBar(display.HiddenStatusBar) --'sprite' is what we will be using to create our spritesheets --'require' lets Corona know that we are making calls out to already --established functions in another file. "sprite" is already built into --Corona so we don't have to do any more work on that end --We will use sprite as a 'sprite handler' to create spritesheets local sprite = require("sprite") &nbsp; --creating a new spritesheet will break the image you put into even blocks that are 100 --by 100, change those parameters to whatever size your images are. Note that this method --of sprite creation only works for sprites that are the same size. There are other methods --to handle sprites of different sizes, but that is beyond the scope of this tutorial. local spriteSheet = sprite.newSpriteSheet("images/rider1.png", 100, 100) &nbsp; --from our spritesheet we create a spriteSet, this is how we how we can group different sprites --together for organizational purposes. Say for example we had 2 different monsters, we could put --them in the same spritesheet and create 2 different sprite sets each holding the information for --their respective frames. This sprite set holds all seven frames in our image,defined by 1 and 7. local monsterSet = sprite.newSpriteSet(spriteSheet, 1, 7) &nbsp; --next we make animations from our sprite sets. To do this simply tell the --function which sprite set to us, next name the animation, give the starting --frame and the number of frames in the animation, the number of milliseconds --we want 1 animation to take, and finally the number of times we want the --animation to run for. 0 will make it run until we tell the animtion to stop sprite.add(monsterSet, "running", 1, 6, 600, 0) sprite.add(monsterSet, "jumping", 7, 7, 1, 1) &nbsp; --the last step is to make a sprite out of our sprite set that holds all of the animtions local hero = sprite.newSprite(monsterSet) &nbsp; --finds the center of the screen x = display.contentWidth/2 y = display.contentHeight/2 --a boolean variable that shows which direction we are moving right = true &nbsp; hero.x = x hero.y = y &nbsp; --use prepare to let the sprite know which animation it is going to use hero:prepare("running") --calling play will start the loaded animation hero:play() &nbsp; function update() &nbsp;&nbsp;&nbsp;&nbsp;--if we are running right then keep moving right &nbsp;&nbsp;&nbsp;&nbsp;if(right) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hero.x = hero.x + 3 &nbsp;&nbsp;&nbsp;&nbsp;--if we are not moving right keep moving left &nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hero.x = hero.x - 3 &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;--if our monster has run off the screen have him turn &nbsp;&nbsp;&nbsp;&nbsp;--and run in the opposite direction. hero.xScale = -1 &nbsp;&nbsp;&nbsp;&nbsp;--will flip our sprite horizontally &nbsp;&nbsp;&nbsp;&nbsp;if(hero.x \> 380) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;right = falsea &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hero.xScale = -1 &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;if(hero.x \< -60) then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;right = true &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hero.xScale = 1 &nbsp;&nbsp;&nbsp;&nbsp;end end &nbsp; --call the update function timer.performWithDelay(1, update, -1) &nbsp;