Scrolling Issue

Good Afternoon,

I’ve been following along with a tutorial from youtube.

https://www.youtube.com/watch?t=1523&v=LBnBml2KFFk

At about the 29th min he starts to talk about scrolling a displaygroup so that the character stays on screen at all times.

I was mostly interested in the section about scrolling the screen. I made a new displaygroup and inserted all of my screen items like he does in the video, however my “view” behaves completely different when I am using composer. I was wondering what I was doing wrong, I am simply just trying to always be able to see the baseball in my screen. 

--------------------------------------------------------------------------------- local newtonOneGroup = display.newGroup() local baseball local function gameLoop() local targetX = baseball.x local targetY = baseball.y newtonOneGroup.x = newtonOneGroup.x + ( targetX - newtonOneGroup.x ) \* .1 newtonOneGroup.y = newtonOneGroup.y + ( targetY - newtonOneGroup.y ) \* .1 print( newtonOneGroup.x ) print( newtonOneGroup.y ) end function scene:create( event ) local sceneGroup = self.view sceneGroup:insert( newtonOneGroup ) physics.setGravity( 0, 9.8 ) baseball = display.newCircle( centerX, 0, baseballRadius ) physics.addBody( baseball, "dynamic", { density = baseballDensity, friction=1, bounce=.32, radius=baseballRadius } ) newtonOneGroup:insert( baseball ) local floor = display.newRect( centerX, \_H-100, \_W, \_H\*.05) physics.addBody( floor, "static", { friction = 1, bounce = 1 , density = 1} ) newtonOneGroup:insert( floor ) Runtime:addEventListener("enterFrame", gameLoop) -- Called when the scene's view does not exist -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc end

BUMP

BUMP