Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Simple Code Practice. — Gideros Forum

Simple Code Practice.

edited January 2013 in General questions
Hi folks,

I have some problems that is need your help because I don't know my current practices are okay.

1.With collision detection, currently I used a simple collision detection based on sprite and no need to create a physics body, like this:
function self:collidesWith(sprite2)
	local x,y,w,h = self:getBounds(stage)
	local x2,y2,w2,h2 = sprite2:getBounds(stage)
	return not ((y+h < y2) or (y > y2+h2) or (x > x2+w2) or (x+w < x2))
I wonder if I use this method, does the game run better compared to method which use physic body? In this method we can only process square object, circle object with transparent edge will return invalid result. Any ideas to to correct this?

2.In my game, I use onEnterFrame event and frameCount to manage movement. In each enter frame event, I must loop around all object in a parent sprite (called group) then process it's movement. Is this a good practice?

3.I find my game speed is ok without sound. With sound added, every time sound channel start to play, the game is a bit freeze. Any help to avoid this?

Thank you very much


Sign In or Register to comment.