I want to spawn tiles randomly as shown in the image. is i have to set 4-5 target points and randomly access it for spawning the tiles.
I want to spawn it endlessly. My player is just stay there and lump left right only. And the tiles keep coming to the player with fix camera.
- spawn a bunch of tiles when the game starts
- have a collision volume behind the player where it’s no longer in player’s view
- when that collision volume overlaps a tile, reposition it to appear ahead of the player
This way you can reuse old tiles rather than keep spawning / destroying new actors - it’s a much better solution from the performance point of view. Especially when you’re working on mobile.
will you provide me tutorial link. either written or in video format. What to search for this.
I don’t know a tutorial for this. It also may be too specific to search. You probably want to study Endless Runners - they usually deal with that kind of stuff.
How about this:
- we create some tiles and use the same event logic to reposition them later on
- the tiles are attached to the
Tile Mover
scene component so it’s enough to update a single component’s position in order to move it all
- the pawn is still, we’re moving a scene component with other components (tiles) attached to it
- when the collision box at the bottom -
Tile Scooper
- overlaps one of the tiles, that tile gets repositioned in front of the pawn
This is all done in a single actor - the Pawn.
Obviously, you’d place the camera closer so the player cannot see the shenanigans.
I’ll zip the project and leave a link here later on.
what is scooped component type and component in next tile event. I set it my tile blueprint object. but primitives’ component object reference is not compatible by physical object reference error occur when i try to pin other component of beginoverlap with my next function component.
what is scooped component type and
component in next tile event
- Primitive Component
If you’re ever in doubt, hover over a pin and read the tooltip:
I made it into a small game over a (very extended, ehm) lunchbreak. It’s too messy to post but if I ever find the time to clean it up, I will.
Thanks i set the value for row and line, and tiles spawn . But it is not moving forward the player.
Is your Game Speed set to 0?
Try it like this:
You probably did not set any of the variables…
Row Spacing and Lane Spacing are responsible for tile distribution. Choose values that suit the size of your tiles.
The just default tiles spawn at starting not destroy or respawn. If i eject the game then the tiles keep moving forward instead of respawn.