+ 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

31st Jul 2020, 2:55 PM
Clueless Coder
Clueless Coder - avatar
6 Respuestas
+ 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.
6th Aug 2020, 8:28 AM
milo
milo - avatar
+ 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
6th Aug 2020, 6:49 AM
Clueless Coder
Clueless Coder - avatar
+ 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
6th Aug 2020, 8:34 AM
milo
milo - avatar
0
when I made a webgame I just used the position, width and height to form the hitbox
5th Aug 2020, 10:36 PM
milo
milo - avatar
0
milo Thanks so much! Do you know phaser yourself or did you do some research?
6th Aug 2020, 8:42 AM
Clueless Coder
Clueless Coder - avatar
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
6th Aug 2020, 8:50 AM
milo
milo - avatar