java - How to get collision using Pixmap Libgdx -


i making game block black falling down in white background. avatar, red dodging black blocks if hits black block, game over. can give me hand in starting this? want avatar check if pixel @ location of block black or white. thanks.

you can read pixel value pixmap using getpixel() method:

https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/pixmap.html#getpixel-int-int-

so if can make approximation of object needs detection can used. i.e. if object (almost) square or circle or can set 4 points representing it. can check 4 points , if of them in collision state object in collision state.

but if need "pixel precision" , sprite i.e. 200x200 pixels need check 200x200 = 40 000 pixels, of course not possible should go other option.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -