Ground is cut off

I have a scrolling background in my application with a character moving along it. The character travels at fast speeds, so I need the ground to be very long, so I made it 10,000 pixels long. I have a function to move the camera when my character moves :

code local function moveCamera()
if (rider.x > 80 and rider.x < 10000) then
game.x = -rider.x + 80
end
end
Runtime:addEventListener( “enterFrame”, moveCamera ) [/code]

and here is the ground:

local ground = display.newImage("snowySetting.png", 0, 0, true) game:insert(ground) ground.y = 307 ground:rotate(180) physics.addBody(ground, "static", {bounce = .5, friction = 0.02})

When I run the app on the simulator, the ground seems to cut off at about 1000 or so pixels. Is there a limit to how big an object can be? [import]uid: 7116 topic_id: 6076 reply_id: 306076[/import]

sorry, it wont let me edit the first bit of code. the forum must have a bug or something [import]uid: 7116 topic_id: 6076 reply_id: 20800[/import]

1024 pixels.

2048 on iPad/iPhone4 i think [import]uid: 6645 topic_id: 6076 reply_id: 20827[/import]

[duplicate removed] [import]uid: 6645 topic_id: 6076 reply_id: 20828[/import]

You must be kidding? Please can someone at Ansca confirm or deny? I have been working on a game with a serious bug in it that me and Graham at Lime are trying to solve and if this is the case that would answer the bug we have I guess. [import]uid: 22737 topic_id: 6076 reply_id: 20857[/import]

I’m with you, this is ridiculous, but there must be some way around it, because aren’t there platformers made with corona? Also is there a way I can just add a second ground after the first one, or no? [import]uid: 7116 topic_id: 6076 reply_id: 20858[/import]

its 1024x1024 per texture. just split it up into smaller objects [import]uid: 6645 topic_id: 6076 reply_id: 20882[/import]

ah! works, thanks. [import]uid: 7116 topic_id: 6076 reply_id: 20903[/import]

Hey
It would be nice if you could elaborate that “ah! works, thanks.” please so that I and more people that wonders also can read how you solved it.

How do you load a large texture and split it into smaller objects inside Corona?

Thanks for your support. [import]uid: 22737 topic_id: 6076 reply_id: 20920[/import]

Sorry! - I just took my 10,000 pixel long ground and made it 1000 pixels long. Then I just made 10 grouns adjacent to each other, like such:

[code]
local ground = display.newImage(“snowGround.png”, 0, 0, true)
game:insert(ground)
ground.y = 340
ground:rotate(180)
physics.addBody(ground, “static”, {bounce = .5, friction = 1})

local ground2 = display.newImage(“snowGround2.png”, 0, 0, true)
game:insert(ground2)
ground2.y = 340
ground2.x = 1490
ground2:rotate(180)
physics.addBody(ground2, “static”, {bounce = .5, friction = 1})

local ground3 = display.newImage(“snowGround.png”, 0, 0, true)
game:insert(ground3)
ground3.y = 340
ground3.x = 2490
ground3:rotate(180)
physics.addBody(ground3, “static”, {bounce = .5, friction = 1})

local ground4 = display.newImage(“snowGround2.png”, 0, 0, true)
game:insert(ground4)
ground4.y = 340
ground4.x = 3490
ground4:rotate(180)
physics.addBody(ground4, “static”, {bounce = .5, friction = 1})[/code]
and so on…

hope this helps :slight_smile: [import]uid: 7116 topic_id: 6076 reply_id: 20950[/import]

aha.
cool, yeah that helped. [import]uid: 22737 topic_id: 6076 reply_id: 21019[/import]