I had to resize the graphics on my app because I had set them up all wrong. I have everything fixed except for one thing. When I try to resize my newImageSheet I can get the image to the size I want but then when I start the game the object just flies off the screen by itself without even being touched. I don’t understand why changing the size of it would do this. Any suggestions?
Code before:
p_options =
{
– Required params
width = 80,
height = 42,
numFrames = 2,
– content scaling
sheetContentWidth = 160,
sheetContentHeight = 42,
}
playerSheet = graphics.newImageSheet( “bird.png”, p_options )
player = display.newSprite( playerSheet, { name=“player”, start=1, count=2, time=500 } )
player.anchorX = 0.5
player.anchorY = 0.5
player.x = display.contentCenterX
player.y = display.contentCenterY
physics.addBody(player, “static”, {density=.1, bounce=0.1, friction=1})
player:applyForce(0, -300, player.x, player.y)
player:play()
screenGroup:insert(player)
Cod after:
p_options =
{
– Required params
width = 40,
height = 21,
numFrames = 2,
– content scaling
sheetContentWidth = 80,
sheetContentHeight = 21,
}
playerSheet = graphics.newImageSheet( “bird.png”, p_options )
player = display.newSprite( playerSheet, { name=“player”, start=1, count=2, time=500 } )
player.anchorX = 0.5
player.anchorY = 0.5
player.x = display.contentCenterX
player.y = display.contentCenterY
physics.addBody(player, “static”, {density=.1, bounce=0.1, friction=1})
player:applyForce(0, -300, player.x, player.y)
player:play()
screenGroup:insert(player)