Side scrolling games - most efficient way to catch things that have scrolled off screen?

I was thinking of using an off screen sensor to detect when objects
have been scrolled off screen, is that optimal?
is there a runtime listener that is better?

similarly , i want to trigger bad guys / traps just before they enter the screen, is the listener better than a sensor test?

any suggestions would be most welcome
cheers!

[import]uid: 118333 topic_id: 22192 reply_id: 322192[/import]

how bout just checking the objects x coordinate

if myObject.x > 480 then
–Do Somthing
end

Of course this would need to be in a runtime listener [import]uid: 59172 topic_id: 22192 reply_id: 88240[/import]

how bout just checking the objects x coordinate

if myObject.x > 480 then
–Do Somthing
end

Of course this would need to be in a runtime listener [import]uid: 59172 topic_id: 22192 reply_id: 88241[/import]

that’s right , but i guess i’m asking that , assuming i have lots
of stuff onscreen, is it more efficient to have a listener checking each thing, or use the physics engine to check against an offscreen sensor object…
the short answer is to try it, but i just wondered if anyone had any experience of this

cheers!
[import]uid: 118333 topic_id: 22192 reply_id: 88242[/import]

so a sensor works fine for dynamic objects, but not static. hmmm
runtime listeners seem expensive for lots of objects - checking a position every frame for every object, just for clean up.
perhaps if i pre-sorted my objects in X and then ran a timer to check every now and then…

anyone done anything similar? should i just let the physics engine deal with it all?

cheers
Andy
[import]uid: 118333 topic_id: 22192 reply_id: 88256[/import]

Take a look at the MultiPuck sample code. (CoronaSDK > SampleCode > Physics > MultiPuck)

This has a function to remove off screen objects :slight_smile: [import]uid: 52491 topic_id: 22192 reply_id: 88287[/import]

perfect, thanks!

(so that’s what the sample code is for… :slight_smile: )

[import]uid: 118333 topic_id: 22192 reply_id: 88316[/import]

When I first started playing with Corona the MultiPuck sample was actually my favorite :wink: [import]uid: 52491 topic_id: 22192 reply_id: 88408[/import]