How To Do This

crapscraps Member Posts: 353
edited November -1 in Working with GS (Mac)
In many of the sling shot games the ammunition travels up the screen and "destroys" when it hits a target.
Not hard to figure out. But if the the ammo does not hit a target - falls short or misses - the ammo hits the ground and destroys.

How do you set up something like that? You cant have the ammo (actor) collide with an invisible wall because it
would destroy - hitting the wall - as it moved up the screen.

Comments

  • LAdrianLAdrian Member Posts: 237
    Why can't you have the ammo destroyed when it hits the actor of the ground itself? Or an invisible ground put on top of the artwork?
    I didn't understood what you meant in you can't have the ammo collide with an invisible wall ....
  • crapscraps Member Posts: 353
    I have done just that - an invisible actor in the foreground of the screen that reaches about half the way up.
    The trouble is that the actor - trying to hit something near the top of the screen has to travel over the invisible wall - collides with it and is destroyed - before it gets to the top of the screen and the target.
  • LAdrianLAdrian Member Posts: 237
    Why do you need the wall that high? A screen-shoot would help understand how you scene looks. Isn't like the classic flat ground with the canon about the ground?
    Anyway I think you need to test when the ammo starts to descent and activate the collision only then. I'm not sure how you do that but it might work by testing the velocity on Y. Again, I'm not sure because I don't have access to my mac to test it but if the Y velocity is bellow 0 then it descends. I did something similar but on the X axis, based on the velocity I tested if an actor moves left or right so I guess you can do the same on Y. Goes up or down if it's above or bellow 0. Again, not sure if it's the velocity but should be a similar attribute anyway.
  • crapscraps Member Posts: 353
    If you anyone gets the chance - check out the free app - Slingshot Cowboy.

    You will notice that if you miss a target on purpose the ammo gets destroyed when it hits the ground. Is it colliding with an invisible actor? If so why doesn't it get destroyed as it "travels" over ( lower on the screen) invisible actors?

    Also how can you constrain the height that the ammo moves up the screen? I never "goes off" the top of the screen.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I see what your getting at. Looks like your going to have a ton of math to make something like that work. I would say it's a lot more in attributes an calculations based on how far back you pull the slingshot back and what angle you pull it down too.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I think you should have the projectile interpolate its size (height and width) and then you could have a rule that says:

    Rule when overlaps with invisible actor
    -----Rule when width is > ????
    --------destroy actor.

    Because interpolate works like a built in timer it will only reach the "reset size" if you fire a really wimpy shot. Otherwise you could try the above rule set and check for the speed of the projectile (linear.motion.Y) insrtead of size. If it is going to slow destroy it.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    scitunes said:
    I think you should have the projectile interpolate its size (height and width) and then you could have a rule that says:

    Rule when overlaps with invisible actor
    -----Rule when width is > ????
    --------destroy actor.

    Because interpolate works like a built in timer it will only reach the "reset size" if you fire a really wimpy shot. Otherwise you could try the above rule set and check for the speed of the projectile (linear.motion.Y) insrtead of size. If it is going to slow destroy it.

    I was thinking something like that but it would still have to have some math to set how fast your projectile shrunk. as well as to determine what level on the "ground" you land since im assuming you will want to simulate the same depth effect as the game you mentioned.
Sign In or Register to comment.