gbusto / BrickBreak

An attempt to make a game like "Ballz" or "Bricks and Balls".
1 stars 0 forks source link

Change Item Hit API to Include an Optional "Bonus" Flag Parameter #536

Open gbusto opened 5 years ago

gbusto commented 5 years ago

To allow balls to have x2 hit when they're on fire, the code is a little hacky and could be improved. Right now in ItemGenerator.hit(), I check if the ballsOnFire flag is set to true and if it is and the item is a block item, I just call item.hitItem() a second time. This is dumb and I think the correct way to do it is to update the Protocol and each Item type to include an optional parameter in their respective .hit() functions to handle and respond to things in their environment.