[英]How can I move a sprite with a player while using arcade physics with gravity?
[英]How Can i move the hitbox of a static sprite, but also not have the object affected by gravity, in the Phaser Framework?
所以我在移相器中有一個可移動的 static 精靈,基本上我希望 object 和它的碰撞箱可以移動並且可以碰撞,同時也不受重力影響
當我制作一個 static 身體時,
this.marker = this.physics.add.staticSprite(0,0, "tileSnap");
命中框保持在 (0,0) 而精靈的 rest 移動
當我把它變成一個普通的物理精靈時,它開始因重力而下降
我該如何解決這個問題?
所以我在這個話題中找到了答案,
就像是
platforms = this.physics.add.image(370, 430, ‘platform’).setImmovable(true)
platforms.body.setAllowGravity(false);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.