Have bullet objects adjust speed when overlapping?

0 favourites
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi!

    Currently I got:

    Tank2 is overlapping Tank1 > set Tank2 bullet speed to 20

    <invert>Tank2 is overlapping Tank1 > set Tank2 bullet speed to 27

    This actually works for me, but not for the other vehicles. These other vehicles are exactly the same way programmed:

    Vehicle2 is overlapping Tank1 > set Vehicle2 bullet speed to 20

    <invert>Vehicle2 is overlapping Tank1 > set Vehicle2 bullet speed to 35

    I've no clue what's wrong.

    I also tried adding the solid behavior to all vehicles as a workaround but that didn't do anything, vehicles just kept overlapping.

    Basically, the vehicles and tanks all spawn on different y positions but I don't want them to overlap when one is going faster than the other.

    I did try detecting collision. However you cannot invert collision. I just want the fastest vehicle lagging behind a slower one, to resume its speed once the slower one is destroyed.

    Does anyone have any ideas?

    Thanks in advance.

    Regards

    -R

  • You may have to add more conditions:

    Tank2 is overlapping Tank1 & is not overlapping vehicle2 > set Tank2 bullet speed to 20

  • Hi Jeffige,

    thanks for your reply.

    So I delved into adding more conditions but I'm a little confused.

    For example;

    Tank1 drives at a speed of 20

    Vehicle1 drives at a speed of 27

    Vehicle2 drives at a speed of 35

    I'm confused as I'm not sure how it will unfold. I can't really grasp what conditions I need to add and how many?

    Perhaps you could post a small sample code?

    Thanks.

  • you need to use

    is overlapping at offset

    therefore when the faster one reach near behind the slower one you set the faster one speed to match the slow one speed at a point behind it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello wizdigitech.

    Thanks for replying, I tried that once but didn't get the desired results. How would one program this? One sample will do.

    Thanks.

    P.S. There are vehicles which travel at different speeds. For example you could have a row of vehicles where the front one travels at 20, the second 30 and the third 50. Will overlap at offset work for that?

    -R

  • You're gonna have to give me some time to see what i can do.

    I have a major issue when displaying a google game leaderboard and it stopping and muting all my audio. This is my last bug before publishing, so i got to get this resolved.

  • Ok,

    so I *think* I'm grasping this.

    This is just a portion. I made the same group for BRDMScout, which speed is 35.

    The BMP2 will slow down and adjust to T72 speed.

    However, the BRDMScout adjusts to BMP2 original speed (27) so it's still overlapping the BMP2. How do I make it adjust to the 'new' speed of the BMP2?

    I tried doing something with (local) variables but of course that only works if there are no copies of the same object on screen.

    Any ideas?

  • If you are up for a more performance , lesser code, more clear ... solution. But with a plugin. Yes, then i have an idea.

    https://www.dropbox.com/s/5o7zzhid8iiq1 ... .capx?dl=0

    plugin: plugin-jcw-trace-raycast_t172320

    I you can use families, it can be done with LOS too.

  • Hello,

    thanks for your reply!

    Yes that does look a lot more simple than what I was trying to do. Your sample .capx works nicely.

    Hey, I own a Construct2 license so I can use families. I did try LOS once, but I had some issues with the cone of view, and it didn't work out for me.

    Since I want the cone of view to 'detect' in a 'straight line', I set the cone of view to 1 or 5 for example. Otherwise it would detect a vehicle above itself or below and I didn't want that. However it only worked for me when I set it to 360.

    Do you think it can still be possible to use LOS then? LOS is something I think I can grasp. Of course, I can use your sample above, but I'm curious as to what I did wrong with the LOS.

    Thanks again.

    • R
  • jeffige you tell me you dont have cranberry game plugin smh

    did you get the tank speed to work i have a little free time now can help

  • wizdigitech Say What??

    Yes, i have cranberrygame plugins.

  • Oops, didn't refresh.

    Let me look.

  • 99Instances2Go Wow, that simple? Amazing!

    I'm going to implement it right away.

  • 99Instances2Go Wow, that simple? Amazing!

    I'm going to implement it right away.

    No, i forgot to return to normal speed. Very sorry. Click to destroy one (i suppose they get killed in your scenario)

    Updated:

    https://www.dropbox.com/s/i8jolmh667vqs ... .capx?dl=0

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)