One shot kill many monsters

This forum is currently in read-only mode.
  • http://macwys.on1.biz/mountain.cap

    One shot kill many monsters.

    How can I fix this?

  • Seems to work properly for me. One shot, one kill.

  • Not when the two monsters in one place.

  • It's because your bullet is big enough to overlap more than one monster at a time, so it's possible to trigger "On collision" for more than one monster before it disappears off-screen.

    Add a "For each monster" loop at the beginning of your bullet-collision event, that will take care of it.

    But really... you're doing so many odd things in the game I think you should probably go through the Ghost Shooter tutorial first. You're moving your bullet manually, and a) you don't need to, because there is a Bullet Behavior, and b) you're not using TimeDelta to move it (or your monsters, for that matter), so it will run differently on different computers. Whenever you move something manually you should always use TimeDelta.

    Also, if you switch to Bullet Behavior for your bullets, you can spawn them and destroy them instead of using just one bullet object and setting it's position off-screen when you don't need it.

  • http://macwys.on1.biz/monkey.cap

    I do not want to be boring.

    But how to do that only a one banana disappeared?

  • macwys.on1.biz/monkey.cap

    I do not want to be boring.

    But how to do that only a one banana disappeared?

    you know what? when i turned on preview mode, nothing appeared, only blank screen. i turned it off and cons crashed. BUG.

  • Open "Event Sheet Editor".

  • If two or more bananas are touching the monkey and you want to destroy only one together with monkey, you have to PICK the banana. You can pick random, closest or whatever you want.

    +Pick a random banana
    +On collision between banana and monkey 
    

    monkeyDestroy

    bananaDestroy[/code:wqeun6kf]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > macwys.on1.biz/monkey.cap

    >

    > I do not want to be boring.

    >

    > But how to do that only a one banana disappeared?

    >

    you know what? when i turned on preview mode, nothing appeared, only blank screen. i turned it off and cons crashed. BUG.

    Nothing should show if you check the events.

    When did it crash?

  • It's because your bullet is big enough to overlap more than one monster at a time, so it's possible to trigger "On collision" for more than one monster before it disappears off-screen.

    Add a "For each monster" loop at the beginning of your bullet-collision event, that will take care of it.

    But really... you're doing so many odd things in the game I think you should probably go through the Ghost Shooter tutorial first. You're moving your bullet manually, and a) you don't need to, because there is a Bullet Behavior, and b) you're not using TimeDelta to move it (or your monsters, for that matter), so it will run differently on different computers. Whenever you move something manually you should always use TimeDelta.

    Also, if you switch to Bullet Behavior for your bullets, you can spawn them and destroy them instead of using just one bullet object and setting it's position off-screen when you don't need it.

    Yes, my shot touches two monsters.

    But I want to only one death.

    In c++ I wrote...

    for(int i=0 ; i<monstersAmount ; i++)
    {
       if(bullet.collision(monster[i]) && bullet.life == 1)
       {
          monster[i].destroy();
          bullet.life = 0;
       }
    }[/code:1ed8d991]
    
    ...and a one monster that has been destroyed.
    
    [b]How to destroy an object instead of two?[/b]
    
    Screenplay:
    [code:1ed8d991]1. shot hits two monsters
    2. first monster dies
    3. shot is destroyed
    4. second monster did not die, because there is no longer a shot[/code:1ed8d991]
  • +Pick a random monster

    + On collision between monster and bullet

    destroy monster

    destroy bullet

    ---

    'Pick' means it selects a random monster, then it checks if it is colliding with the bullet... it will always pick ONE monster, so only THAT monster will be destroyed together with the bullet.

  • +Pick nearest monster

    + On collision between monster and bullet

    > destroy monster

    > destroy bullet

    ---

    'Pick' means it selects a random monster, then it checks if it is colliding with the bullet... it will always pick ONE monster, so only THAT monster will be destroyed together with the bullet.

    Becouse why not make it simple?

  • How to destroy an object instead of two?

    Read the rest of my post:

    Add a "For each monster" loop at the beginning of your bullet-collision event, that will take care of it.

  • > How to destroy an object instead of two?

    >

    Read the rest of my post:

    > Add a "For each monster" loop at the beginning of your bullet-collision event, that will take care of it.

    >

    I tried.

    Do not work.

    Are you sure?

    I checked repeatedly.

    You can give an example?

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