grumpygamer Posted May 14, 2015 Share Posted May 14, 2015 Hello fellas,I'm in the process of structuring weaponry for my shmup. Instead of having one shot from the spaceship, it will have different cannons that will shoot different bullet types that cause different damage (and effects).What I need to do also - is - at impact of each different bullet with an enemy a few calculations have to be made: 1. the damage caused (for example > difference between the enemy armor and the shot damage)2. the critical hit chance3. the critical hit damage4. the area damage5. any particular effect. I was just wondering if this is even possible - first of all, and how would I track each bullet. I've still got to do this, so I have not got any code yet, just asking for some advice.Thanks guys! Link to comment Share on other sites More sharing options...
nuvorm Posted May 14, 2015 Share Posted May 14, 2015 You can add all bullets to a group and check if the player collides with that group.On collision you can get the bullet that you collide with and check its damage value and type perhaps? Link to comment Share on other sites More sharing options...
drhayes Posted May 14, 2015 Share Posted May 14, 2015 Is each bullet a sprite? Can you extend Phaser.Sprite and include all these as properties in the class? Then, on collision, you could read the values for their effects. Then, yeah, each bullet could be added to a Group and then you can check player collision against the group. Link to comment Share on other sites More sharing options...
ZoomBox Posted May 15, 2015 Share Posted May 15, 2015 That it:Either you extend Phaser.Sprite (which I would recommand, check the Phaser examples)Or you could (since javascript is flexible) simply create a sprite that contains custom properties: mySprite.desiredDmg = 10; mySprite.shootArea = 300; But I wouldn't recommand this since it can quickly become messy. Link to comment Share on other sites More sharing options...
grumpygamer Posted May 15, 2015 Author Share Posted May 15, 2015 Ok thanks, I'll keep this in mind when I start it.Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts