glen_a_smith Posted December 21, 2015 Share Posted December 21, 2015 Hi Guys, New to Phaser, and working on a Space Invaders clone per the sample code in the phaser repo. It's going great but I've hit a blocker. I wanted to add those protective bases that decompose on collision. In the original arcade game, the bases decompose dynamically as bullets hit them (see pic) so I can't really just use static animations since it's just the pixels around the bullet collision that get decomposed. How would you guys approach the problem? I know there are facilities to just draw on the bitmap of the Sprite (eg copy BitmapData)? Perhaps I could do that and just remove a few random pixels (or draw in black on them?) around the collision x/y? Happy to do the homework, just after a bit of inspiration on how best to approach it? Thanks, Glen. Link to comment Share on other sites More sharing options...
LoneStranger Posted December 24, 2015 Share Posted December 24, 2015 Take a look at the Tanks demo on the Phaser website. Much like you have already thought about, it uses a bitmap for the ground, which take circular damage as it is hit by the player bullets. You could probably do something similar with the shields, either cutting circles out of them or using some other damage pattern. Link to comment Share on other sites More sharing options...
glen_a_smith Posted December 27, 2015 Author Share Posted December 27, 2015 Thanks for the pointer. BitmapsData for the win! Blogged it up in case anyone bumps into a similar issue down the track. Thanks for the tips! Glen. Link to comment Share on other sites More sharing options...
Recommended Posts