Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
How can I move a sprite with a player while using arcade physics with gravity?

I want to have a player that runs around with a gun. Seems like that shouldn't be too hard, but it keeps getting more and more complicated. I thought of using a container, but containers don't allow gravity, so I can't use that. Then I tried using a physics group, which kind of worked. There is a big issue with the physics group though. I can only have gravity on or off for ALL objects in the group which isn't what I want. Obviously I want the player to have gravity and jump around, but the gun shouldn't fall through the world. The player should have gravity, the gun shouldn't. In fact I'm pretty sure the gun doesn't need physics at all. Is there a way to disable gravity for just one object in a physics group? Or is there a better approach to my issue altogether where you don't use a group?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

So it turned out that I'm actually just dumb an containers DO have physics bodies. It didn't work when I tried it, but that was because of something else I did wrong, and not the physics body. It works now if I use a container to move everything together.

about 4 years ago · Juan Pablo Isaza Relatório

0

I would:

  1. create a custom based on Phaser Sprite / GameObject / Container (depending on the properties needed).

  2. In that custom Object, I would add the needed extra GameObject(s), to the scene, in the constructor.

  3. Update the position(s) of those extra object(s) in the custom object itself, so they would not need/have a own physics body and move in sync with the "base" Sprite.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda