Memory and Sprite.colliedWith( TiledLayer tLayer, boolean p)

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Memory and Sprite.colliedWith( TiledLayer tLayer, boolean p)

Postby jestan » Tue Nov 27, 2007 6:11 am

Hi,
I am developing 2D scroller game. In that game i use .colliedWith(tiledLayer, true) to a sprite to detect collision with TiledLayer. The game works fine, but when the sprite collieds with TiledLayer, i could see, increasing memory usage in memory monitor tool and int array objects are increased in memory by the above method. Then i used .colliedWith(tiledLayer, false) and now the problem is over. My doubt is why it happens?

Thanks.

Jestan
jestan
 
Posts: 22
Joined: Thu Jun 14, 2007 11:26 am

Re: Memory and Sprite.colliedWith( TiledLayer tLayer, boolean p)

Postby DevelopmentTeam » Tue Nov 27, 2007 8:24 am

The second parameter specifies pixellevel. If this is true the class checks pixel-by-pixel and checks collision of opaque pixels only. This might be useful for an irregular object. But obviously it consumes more CPU power and memory. If this parameter is set to false the class checks collision with the corner of both objects alone.

So now you would obviously understand the memory usage and CPU usage for both cases
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Memory and Sprite.colliedWith( TiledLayer tLayer, boolean p)

Postby jestan » Wed Nov 28, 2007 6:17 am

Thanks for the reply :)
Jestan.
jestan
 
Posts: 22
Joined: Thu Jun 14, 2007 11:26 am

Re: Memory and Sprite.colliedWith( TiledLayer tLayer, boolean p)

Postby DevelopmentTeam » Wed Nov 28, 2007 6:26 am

:) welcome...
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 3 guests

cron