Tightening collision detection

zombieninjaszombieninjas Member Posts: 10
edited November -1 in Working with GS (Mac)
I'm working on an R-type...type... shooter, so it is going to be very fast paced. what i have so far is good, but the bullets shot from my player dont all register as a hit, it seems to be every third of fourth bullet shot detected as a hit. Does anyone have any tips on how to make this a bit tighter?

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Heh - I bet you've hardly got anything going and I'm already looking forward to this. LOVE R-Type :D

    As to your question, how rapidly is your ship shooting?

    Also, if may be worth changing the collision shape to square (you can change it from square to circle in an actor's attributes - it's where you define the size, change position, disable/enable moveable etc).

    If you're shooting too fast for the shots to all register (look, I don't know, I'm making this up as I go along) then try reducing the shot rate till you get a nice solid hit every time.

    Hope that helps :D

    QS.

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

  • KamazarKamazar Member Posts: 287
    I remember there being a problem like this before... I forget why, but sometimes the collisions focuses around an actor's origin point. To make it tighter, hmmm...

    Say the actor you're shooting is 50 x 50 pixels. If the bullet hits at:

    X is equal or greater than 25 or X is equal or less than 25

    OR

    Y is equal or greater than 25 or y is equal or less than 25

    Subtract 25 from health.

    I'm sorry if what I'm saying isn't too clear. If someone could maybe iterate what I was saying if they get it...

    On the off-chance that I'm totally wrong about this (and try this before going crazy with what I just typed), up the density for the what you're shooting. Just a hunch.
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    I wanna say I've observed that rules using collision work better when there is also a collision behavior linking the two actors...

    If that is even true, you have to deal with the items bouncing when they hit...
  • netdzynrnetdzynr Member Posts: 296
    Love R-Type as well (I have a full arcade machine of R-Type 1 in my garage). Are you using images for bullets? Not sure if this would help, but maybe try adding some extra transparent space around your PNG images so that they provide a larger "hit region" but look identical to the bullets you currently have.
  • zombieninjaszombieninjas Member Posts: 10
    Yeah I'm going for Gold and modeling everything I make after R-Type 3, probably the best in the series IMO. I upped my fire rate from every .25 seconds to every .15, but now it looks like a steady stream on water rather than a a barrage of death. I'll try what netdzynr suggested and add some transparency to the image to solve that issue.

    Also, I noticed the sin and cos tutorial for getting the enemies to move in waves, which was a tremendous help, but I'm curious if anyone knows how to get other types of movements, Z formations and the like. It's been a while since I took a math class so I might just have to brush up a little to figure that one out.
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    A fix i had work for me is to have the bullet spawn an invisible actor that is a little bigger that will connect with the enemy a little longer even if it desrtroys itself after a fraction of a second.
    So basically the bullet collides, bullets spawns trigger, trigger kills enemy, trigger destroys itself so it doesnt get more enemies

    often actors did collide but some of the rules just didnt trigger
    Timers invloved can mess up even more

    for example if your enemy is hit with a bullet and you have the often needed "destroy after .02 seconds" so that your enemy can trigger a rule before dying.

    sometimes the timer rule wont trigger but i know they connected for a micro second because other rules triggered
  • quantumsheepquantumsheep Member Posts: 8,188
    Another bit of advice for you, mate.

    From what you said in another thread, it seems you're trying out the free version of GS - which is all good - it lets you build games after all!

    What I'd be careful of is making a game that will not fit on an iPhone.

    What I mean is, that your rate of fire may cripple your game on earlier machines (as in 1st gen ipod touch, iphone 3G).

    My two upcoming shooters will be 3GS only. There's so many bullets and enemies on-screen that the earlier models just can't handle it.

    There are ways of optimising for earlier models, but I really didn't want to compromise on the action ;)

    Of course, if your target device is an iPad, then go for it - I've heard it can handle pretty much anything!

    One other thing I thought of that might help. People making tower defence games often ask how they can move actors along a path. One solution is to have invisible 'walls' that when hit, make an actor walk in another direction.

    With a little planning and imagination, i reckon you could incorporate something like that in a shooter for more varied movement.

    Or just use the 'interpolate' behaviour lots!

    Best of luck!

    QS :D

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

  • zombieninjaszombieninjas Member Posts: 10
    Thanks! Yeah this is going to be for the iPad, it's got the best resolution for my visual style
  • quantumsheepquantumsheep Member Posts: 8,188
    Awesome then! I love my shooters! If you're taking R-Type as your inspiration, I'm excited to see it. Some great diversity in that, and inspired level design :D

    QS

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

Sign In or Register to comment.