+ 1
Phaser sprites off-center
How can I set the sprites to be centered in their hitboxes? Specifically the enemies, they have a large offset. https://code.sololearn.com/WFhua6YZ9Um2/?ref=app
6 Answers
+ 1
https://code.sololearn.com/WtmygMtXodt0/?ref=app
I tried changing the bodies offset of the enemies , player and bullet and now they are centered angain,
The only thing is that this has to be changed or added manually every time you change sizes or add new objects.
+ 1
milo Was it with Phaser? If so, can you show me? I'm using setSize(width, height, center=true) but it still won't work
+ 1
here they had a similar problem to yours Maibe it helps
https://www.html5gamedevs.com/topic/36013-adjusting-sprite-collider-offset-after-scaling-a-sprite/
I hope it helps, otherwise I'm sorry.
And good luck with your shooter
0
when I made a webgame I just used the position, width and height to form the hitbox
0
milo Thanks so much! Do you know phaser yourself or did you do some research?
0
I just did some research, learned how to search when I made a webgame(without phaser, just JavaScript) myself and it really helps for any language or topic