snek icon indicating copy to clipboard operation
snek copied to clipboard

Make makeBomb(x,y) accept absolute pixel values, not grid position

Open flukeout opened this issue 8 years ago • 4 comments

This makes it more versatile and then it doesn't have to care about how bit the grid sections are. Should be the case for all particle generating.

flukeout avatar Sep 22 '16 01:09 flukeout

We could pass an x/y grid coordinate with optional px/py pixel offset inside that grid rectangle?

Pomax avatar Sep 22 '16 16:09 Pomax

Yeah, but I think the particle thing has use beyond our game so makes sense to make it less dependent on knowing some kind of grid and offset.

I think also if you pass in an x,y with a width of 50 or 100 - it should just do the offset calculations to center it on x/y by itself. This assumes equal width/height for particles, but that will be the general case I think.

flukeout avatar Sep 22 '16 17:09 flukeout

+1 for centering. We can make a little layer between the game logic and the particles library so that when you call makeParticles(x,y) or something it autoconverts and calls particles.makeParticles(x-in-pixels, y-in-pixels), so that the game logic can keep using grid coordinates but the particle library only has to deal with pixel values

Pomax avatar Sep 22 '16 18:09 Pomax

Yeah sounds good to me. Eventually I'd like to release/offer the particle maker as a standalone thing, so that will be useful. We can make some kinda getPixelsFromGridCoords(x,y) type of function.

flukeout avatar Sep 22 '16 18:09 flukeout