Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Foxtacy

Pages: 1 [2]
Hello my friend!

I think you need to

Well i see some problems there:

"Then I realized I would at some point have to iterate through this group to find all living enemies y values for a particular function."

Maybe you should try to create a function to filter the living enemies using stuff like: yourGroup.countLiving() and yourGroup.getFirstAlive();

After realizing this, I tried destroy(), but that caused many internal problems.

You should NEVER use destroy(). Because destroy might nullify your enemies, and it will cause you many problems. You should call destroy when you close the game, to clean up the memory.

Now, about this:

"theGroup.remove(theEnemy, true)"

I don't think this is a good idea. because when you kill() an enemy, you don't actually need to remove it from the group.

Check out the tutorials on about object pools, this site might give you a glance of what you're doing wrong (and it has very good tutorials too :D)

To keep your enemies onscreen, you might want to do so by tilemap collision (that's what i'm doing on my game here)

something like:

FlxG.collide(tilemap, enemy);

and within your tileset, there's a way to set what tiles will be unable to pass through.

And if you want to allow them to fly off screen just comment this collision check and Bazinga! your enemies will be able to go off screen :D

I hope i have helped you with your problem, or maybe have ideas on how to solve it :D

help / Re: Doubt with Collision between groups
« on: Fri, Jan 20, 2012 »
I get it now!

Thank you very very much my friend! :D

help / Re: Box2D + FlxCamera following the player?
« on: Thu, Jan 19, 2012 »
^ ^

I'm glad it helped... or sort of...

help / Re: Any good pixel art tutorials?
« on: Thu, Jan 19, 2012 »
Never drew anything in my whole life,

What do you guys think of this?

help / Re: Box2D + FlxCamera following the player?
« on: Thu, Jan 19, 2012 »
There i fixed it!

help / Re: Doubt with Collision between groups
« on: Thu, Jan 19, 2012 »
I think i get it!

So, i don't need to iterate over the groups right?

i mean,

i should leave it to the FlxG.collide() function, am i right?

This was a very enlightening post my friend! thank you very much!

help / Re: Box2D + FlxCamera following the player?
« on: Wed, Jan 18, 2012 »
There you go, the whole project with Flixel + Box2D stuff :)

Sorry bout that... i was doing thousands of things at the same time *facepalm*

help / Re: Box2D + FlxCamera following the player?
« on: Wed, Jan 18, 2012 »
Look, i have tried to use Box2D with Flixel

but then i took an arrow in the knee

To do so, you will have to create wrappers to integrate flixel stuff, and box2d stuff.

I'm gonna post here a link with an example i did trying to figure out how to integrate flixel and box2d stuff. Then you can use it as a reference

But later, since i'm not home right now ^^

help / Doubt with Collision between groups
« on: Wed, Jan 18, 2012 »
Hello everybody! Hope you're all having an awesome day!

I have a doubt here about collisions between groups

Ok, so, on my game i have the following scenario.

I have:

- a FlxWeapon on my Player class (which has a group of bullets)
- a group to manage the enemies on the screen.

Which is the propper way to test the collision between a single bullet, and a single enemy?

Because, this is what i have in mind:

If i check collisions like this: FlxG.overlaps(enemyGroup,, when a bullet collide with an enemy, i can't tell which instance of enemy in enemyGroup the bullet collided with.

In that case, how do i figure out which instance of enemy on enemyGroup took the bullet? and how do i get the instance of the bullet that has collided with a single instance of enemy?

Pages: 1 [2]