Closed CarstenHoyer closed 4 years ago
That'll be coming in v0.3.0! If you want to use it right away, you can install react-phaser-fiber@next
.
The Invaders example in the next
branch makes use of it for the background, if you wanted to see it in action.
Just a follow up - using next - I don't think this example is possible to replicate. I mean the collision with a TileSprite. https://samme.github.io/phaser-examples-mirror/tile%20sprites/colliding%20with%20tiling%20sprite.html
My current workaround
<Group>
<ArcadeImage
{...props}
x={0}
y={768 - 128}
displayWidth={1024}
displayHeight={128}
ref={ref}
name="platform"
texture="ground"
immovable
allowGravity={false}
velocity={velocity}
/>
<TileSprite
depth={0}
x={0}
y={768 - 128}
width={1024}
height={128}
name="platform"
texture="textures/ground"
tilePositionY={0}
/>
</Group>
Hm, interesting... I'll have to give some thought on a proper API for this. A potential workaround may be to get the ref of the TileSprite, and call game.physics.enable(tileSpriteRef.current)
in a useLayoutEffect.
edit: er, that appears to be the phaser 2 API. Phaser 3 should be something like game.physics.add.existing()
for Arcade.
I've pushed v0.3.0-beta.2
which includes a new ArcadePhysics
component. Give it a try @CarstenHoyer and let me know if you run into any issues. I've made a little example on codesandbox
https://codesandbox.io/s/enable-arcade-physics-example-kt7el?file=/src/App.js
Hey,
This library looks very promising.
I could really use a TileSprite (I don't have experience with Phaser yet, but it looks to me, the way to create something like a platform with a repeated tile graphic, is with the tile sprite object).
If you could make it as a PR, I guess it would be possible to copy and create future requests as PRs instead.
Thanks.