collide with enemies...

MarcoColMarcoCol Member, PRO Posts: 279
edited September 2012 in Working with GS (Mac)
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?

Comments

  • MarcoColMarcoCol Member, PRO Posts: 279
    has no one an idea?
    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.
  • MarcoColMarcoCol Member, PRO Posts: 279
    and again to this:
    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.
  • TechNoirTechNoir Member, PRO Posts: 117
    @MacroCol If your enemies 'sometimes' fall through the player without destroying,, place the enemies into a tag... called enemies.. then on the player set when player overlaps or collides with tag enemies take action..

    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.

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi TechNoir,
    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
  • quantumsheepquantumsheep Member Posts: 8,188
    edited September 2012
    I have an older version of GS, so this may not be accurate - but there are tabs at the top of a project:

    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 :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi,

    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.

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi all together. I found out the reason of the wrong collision, maybe someone interests. So if I don't use the camera movement and only let scroll the background - as in the sidescroller of the examples - then it works correctly. In my game it worked also correctly, but only in the first Scene. When I was outside of them, than it doesn't work.
Sign In or Register to comment.