简体   繁体   中英

Collision in java and libgdx in making an android game

i've already followed this steps here - Sprite not moving properly. libgdx

i have a hero, a simple crate and the map. i want to attach a collision on the crate so that when the hero collides with the crate it won't pass through. how can i do that using the codes from the link?

To get this thing done , i will advice you to use , Box2D instead of simple collision check ,via bounds/position. Plus it will look more realistic . Create 2 bodies , one for player(Dynamic Body) and one for crate(Static Body).In that case You will not need to check collision to make sure player won't pass through crate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM