Collision Error! HELP!

I have uploaded my game to the IOS App Store and it works pretty well. I n order to get it up I had to enable graphics compatibility v1. When I upgraded my corona to a 2000+ build and turned on compatibility v1, my “player” sprite and the invisible bars at the top and the bottom of the screen don’t collide. So, my “player” will just fall off of the screen. I want the “player” sprite to blow up when it hits the bottom or top of the screen. After all the game is a side scroller.

Here’s the code:

    ceiling = display.newImage(“invisibleTile.png”)
    ceiling:setReferencePoint(display.BottomLeftReferencePoint)
    ceiling.anchorX = 0
    ceiling.anchorY = 0
    physics.addBody(ceiling, “static”, {bounce=0.1, friction=.2})
    screenGroup:insert(ceiling)
   
    theFloor = display.newImage(“invisibleTile.png”)
    theFloor:setReferencePoint(display.BottomLeftReferencePoint)
    theFloor.anchorX = 0
    theFloor.anchorY = 340
    physics.addBody(theFloor, “static”, {bounce=0.1, friction=.2})
    screenGroup:insert(theFloor)
 
    city1 = display.newImage(“city1.png”)
    city1:setReferencePoint(display.BottomLeftReferencePoint)
    city1.x = 0
    city1.y = 320
    city1.speed = 1
    screenGroup:insert(city1)

    city2 = display.newImage(“city1.png”)
    city2:setReferencePoint(display.BottomLeftReferencePoint)
    city2.x = 480
    city2.y = 320
    city2.speed = 1
    screenGroup:insert(city2)

    city3 = display.newImage(“city2.png”)
    city3:setReferencePoint(display.BottomLeftReferencePoint)
    city3.x = 0
    city3.y = 320
    city3.speed = 2
    screenGroup:insert(city3)

    city4 = display.newImage(“city2.png”)
    city4:setReferencePoint(display.BottomLeftReferencePoint)
    city4.x = 480
    city4.y = 320
    city4.speed = 2
    screenGroup:insert(city4)
   
   
    jetSpriteSheet = sprite.newSpriteSheet(“jet.png”, 44, 17)
    jetSprites = sprite.newSpriteSet(jetSpriteSheet, 1, 4)
    sprite.add(jetSprites, “jets”, 1, 4, 750, 0)
    jet = sprite.newSprite(jetSprites)
    jet.x = -80
    jet.y = 100
    jet:prepare(“jets”)
    jet:play()
    jet.collided = false
    physics.addBody(jet, “static”, {density=.1, bounce=0.1, friction=.2, radius=12})
 screenGroup:insert(jet)
 jetIntro = transition.to(jet,{time=1000, x=100, onComplete=jetReady})

Hi @longswordentertainment,

I notice that all 3 of your objects to collide are “static” type. In any collision-based scenario, at least one of the objects must be “dynamic” type… this has always been the case, in both V1 and Graphics 2.0. So, please change the jet (player) to dynamic and the collisions should work again.

Also, you should avoid “mixing” reference points with anchor points. If using V1, you can still use reference points. Anchor points are reserved for 2.0.

Best regards,

Brent Sorrentino

Hi @longswordentertainment,

I notice that all 3 of your objects to collide are “static” type. In any collision-based scenario, at least one of the objects must be “dynamic” type… this has always been the case, in both V1 and Graphics 2.0. So, please change the jet (player) to dynamic and the collisions should work again.

Also, you should avoid “mixing” reference points with anchor points. If using V1, you can still use reference points. Anchor points are reserved for 2.0.

Best regards,

Brent Sorrentino