collide with enemies...
MarcoCol
Member, PRO Posts: 279
I want to make a vertical-scroller. So for the enemies I have a spawner, outside the window, which spawns different enemies all the time. The Player can move up and the scene then moves/camera scrolls up.
So I made the rules, if the enemies overlap/collide with the player, that the enemies will be destroyed and player left a life.
That works correctly, when I am on the bottom of the scene. But when I moved something up, then sometimes:
a) the enemies fall through the player, without destroying, without losing a life
b) a few pixels over the player, they destroy and player loses a life.
I also look on the example-project, the sidescroller, and generally I do the same, but there it works 100%.
Where made I the mistake?
So I made the rules, if the enemies overlap/collide with the player, that the enemies will be destroyed and player left a life.
That works correctly, when I am on the bottom of the scene. But when I moved something up, then sometimes:
a) the enemies fall through the player, without destroying, without losing a life
b) a few pixels over the player, they destroy and player loses a life.
I also look on the example-project, the sidescroller, and generally I do the same, but there it works 100%.
Where made I the mistake?
Comments
I was just wondering, why this happens only if I move enemies from up to down and player from down to up.
In the example-projekte, where the same happens from left to right and right to left, it works without problems.
Where should I place the spawner? I set it only a bit outside the scene, not at the end of the scene.
If I move and stand about 300px from bottom, then the enemie hits me correctly and I lost a life. But when moving, it seems, there the is a huge distance of maybe approx 200 px. where I lost a life, but enemie is still away this distance.
also take a look at your collision shapes on the enemy are they set to rectangle or circular..
Also try expand your scene to 1000 pixels high,, and place your spawner further up on the scene.. then try again.
ok. Currently the Scene is about 4000px high. Screenview is 960px high. And Spawner is placed about 1100px high.
The collision-shape is set to rectangle of the enemy.
How and where can I place the enemies into a "tag"?
Thank you
Best, Marco
Project info
Scenes
Actors
Tables
Services
Click the 'Actors' tab and you'll see all the actors in your game currently. On the left hand side you can press the '+' button at the bottom to create a new tag. Then just drag the actors you want into the newly created tag.
You can also rename the tag to whatever you want, e.g. 'enemies'.
Hope that helps!
With regard to enemy collisions - if they're getting hit while a little way away from the player ship, either the player ship or the enemies may have blank 'space' between the graphic and the edge of the actor.
Try to make graphics that fit snuggly at the edges for more accurate collision.
A tip for vertical shooters - a lot of them use hit boxes, especially on the player ships. These are essentially a new actor that is smaller than the size of the player ship and constrained to the player ship.
It can lead to 'fairer' collision detection (with regards to player's experience of the gameplay) and exciting 'close shaves'.
Cheers,
QS
:
DDr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I do it wirh tags, but there is no change.
In the game I've set the control-camera-feature. Maybe it's because of that? If I am in the first "screen" of the approx 4000px height scene, then everything works.
But if I move up, then there come the problems. I move with buttons.