User Tag List

Results 1 to 4 of 4

Thread: Limited amount of grenades

  1. #1
    No Products Registered

    Join Date
    May 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Limited amount of grenades

    Hi!

    I'm making 2D-platformer where my character can move, jump, shoot with a gun and throw grenades.

    The grenade throwing is done like this:

    Upon pressing X, make an object (grenade) at 0,0 from (character).

    Grenade has a pinball movement and when it hits the ground, program makes an explosion right on there where grenade landed. I have set the directions and stuff right but I'd like to set it so that you can't throw unlimited amount of grenades. How can I do it?

    I have tried this (this works with shooting an object):

    (Grenade counter)=0, destroy grenade

    So when the grenade counter equals 0 (I have no grenades left) and I try to throw some more, it will immediately destroy the grenade that I try to throw. The problem is if I throw all my grenades rapidly and when I throw my last one, the program destroys not only that last grenade but also the other grenades that are still in air.

    So I'd like to set it in either of these ways:

    1) There are limited amount of grenades and when grenade counter reaches 0, you can't throw any more grenades.

    2) When you throw a grenade, you'll have to wait a certain amount of time to throw the next one. By this spamming grenades isn't possible and grenades can't be destroyed while they are in air.

    The other small problem is when you have 10 grenades, you really have nine because the program will destroy the last grenade automatically: counter shows you have one grenade and you throw it but it disappears because the counter switches to zero at the same second you press the throwing button.

    Thanks. I hope you understand my text as my English skills aren't very good.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Limited amount of grenades

    Hi there,

    You can add more than one condition into events by right-clicking on the event and selecting "Insert". This way, you could have an event that only triggers when:

    Player presses X
    + The grenade counter is greater than 0
    --> Throw a grenade
    --> Subtract 1 from the grenade counter

    This way, you don't have to have a separate event to destroy grenades as soon as they're created, if the counter is 0 - this event will only allow the player to throw one if the counter is also above 0.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator ProPatch Maker

    Join Date
    Jun 2006
    Location
    Norway
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Limited amount of grenades

    This is what you do:

    Give your player character two values (go to active object properties - Values and select new alterable value):

    Name the two new values "Grenades" and "Grenade timer"

    Go to the event editor to you throw event and add another condition (right click on the left cell and select "new"). Set up your event like this:

    0 Upon pressing X, make an object (grenade) at 0,0 from (character).
    - Grenades are greater then "0"

    =

    Throw grandes (as you allready have done)
    Subtract from value "Granades" "1"

    Now the player will only shoot when he has more then 0 grenades

    The timer. When the player throws a grenade, set the timer to 10 (or whatever). When grenade timer is greater than 10: subtract 1 from grenade timer.

    Now make your grenade throwing event like this:
    0 Upon pressing X, make an object (grenade) at 0,0 from (character).
    - Grenades are greater then "0"
    - Grenade Timer is greater then "0"

    Done!

    EDIT:
    Bah! I type to slow. Do what David says

  4. #4
    No Products Registered

    Join Date
    May 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Limited amount of grenades

    It works! Thanks to both of you!

Similar Threads

  1. Grenades...
    By MostDreaded in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 12th January 2011, 01:55 AM
  2. 360 Grenades for MostDreaded
    By Watermelon786 in forum File Archive
    Replies: 0
    Last Post: 12th January 2011, 12:22 AM
  3. Is there a limited amount of extensions available?
    By RickyRombo in forum Hardware Accelerated Runtime
    Replies: 0
    Last Post: 3rd August 2009, 01:33 AM
  4. Limited amount of Groups/Events?
    By N64Mario in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 4th February 2009, 02:56 AM
  5. Grenades for GodSpeed8118
    By Brandon in forum File Archive
    Replies: 1
    Last Post: 23rd July 2008, 11:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •