FlixelCommunity / Flixel-Power-Tools

The Flixel Power Tools are a package of classes designed to provide extra functionality to your Flixel games. Originally created by Richard Davey (Photon Storm), this is the Flixel Community fork of the library, striving to keep the library living and up to date with the latest version of Flixel.
http://www.photonstorm.com/flixel-power-tools
Other
8 stars 3 forks source link

[CLOSED] Way to retrieve the weapon from a bullet #9

Closed FlixelCommunityBot closed 10 years ago

FlixelCommunityBot commented 10 years ago

Issue by alextfish from Monday Oct 03, 2011 at 12:05 GMT Originally opened as https://github.com/photonstorm/Flixel-Power-Tools/issues/9


This issue was reported on the Flixel forums. At the moment, in the collision function between a bullet and something else, there's no way to tell what kind of bullet it is; i.e. what weapon it was fired from. The only way to get this is to use a different FlxGroup for each weapon's bullets, and then perform each collision check with each FlxGroup, passing in a different callback function. It'd potentially simplify user code if there was an easy way to retrieve the weapon from a bullet so we can tell what kind of weapon it is.

FlixelCommunityBot commented 10 years ago

Comment by photonstorm from Wednesday Oct 12, 2011 at 10:56 GMT


Bullets now have a protected var called "weapon" which links to the instance of the weapon from which it was fired. This isn't perfect, but should be enough for now. V2.0 of FPT restructures this significantly.