User Tag List

Results 1 to 5 of 5

Thread: How to use different weapons?

  1. #1
    No Products Registered

    Join Date
    May 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to use different weapons?

    So I am making a game, similar to Castlevania, but with guns! I added 4 animations for each weapon. When the character collides with the weapon, how do I make it so that when the character clicks a button it shoots that weapon he picked up, and when it runs out of ammo, it switches back to the starter weapon. I also have a problem when you shoot. When you shoot, the character stays on the first frame, then when I move it continues the animation. I would like it so that when the character is stationary, it plays the animation without pausing on a frame. I am new to MMF2 so please explain everything as well as you can! Thank you guys!

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Hello and welcome to the forum TurtleLord!
    There are many, many ways in fusion to accomplish what you're talking about.

    To determine the best way to approach this, main things you'd have to clarify are:

    1) wether the player can hold multiple weapons in its "inventory" and switch between them, or if he can carry only one weapon at a time

    2) if with "starter weapon" you intend "previously picked weapon" or "basic-crappy starting weapon"

    in case of "only one weapon at time" setup:
    3) do you plan to "reset" ammo count to zero on every weapon switch, or keep track of last ammo count for each weapon on switching?


    As for the animation problem, I've hard times understanding the issue:

    -does the animation "shooting" correctly plays?
    -or does it plays for too long/short?
    -or does it continue playing even after you've moved again?
    -or do you want your player to shoot while walking?


    I LOVE Castlevania games, hope you best luck with your project

  3. #3
    No Products Registered

    Join Date
    May 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Shrodinger! Sorry it took a while to get back to you. I have created a YouTube video on the animation problem. Also, would you mind telling me how to do the weapon select. I would like there to be a different amount of ammo in each weapon. Thank you! Here is the link https://www.youtube.com/watch?v=tfsMka_isyE

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Oh, I see, the animation stops without apparent reason.
    Does this happen randomically / or does this always happens at same moment?
    I'm sorry but it's difficult to tell only from the video. Uploading an .mfa will greatly help.
    At first sight, it seems something that has to do with your coding of animation changes in the event editor.


    For different ammo/different weapon:

    I'd say for a good beginning and understanding a very key Fusion feature, you could use your main player's alterable values.
    In frame editor, click your player's animation, and then click the "A-Z" tab under "Properties".
    You will see "alterable value A"
    double click it and name it "my_weapon"
    now click "new"
    and create another variable named "shotgun_ammo"
    and so on, for all your weapons.
    Remember the order in which you place them,
    because we will retrieve them by ther value index.

    Now in the event editor add these three different "class" of conditions:

    1) picking weapon
    Player collides with object "Shotgun"
    >>> set alterable value "my_weapon" to 1

    replicate for each pickable bonus weapon,
    remember that Alterable string C will be no. 2, and so on.

    2) shooting
    Player press fire 1
    + my_weapon > 0
    + alterable value (altval "player",0) > 0
    (this could be a little tricky to setup, just do exactly this: add the condition and rightclick your player,
    click "alterable values", click "compare to one of the alterable values", click "use expression" on top right, rightclick your player, click values-alterable values by index, write "0" in "enter value here", click Ok, select "greater", click OK.... phew!)
    >>> set internal flag 0 of player on, subtract 1 from alt. value ----> alterable value (altval "player",0) as we did before
    (all this to save you from coding each weapon one by one!)

    Player press fire 1
    + alterable value (altval "player",0) = 0
    >>> set my_weapon to 0, set internal flag 0 of player on
    (this is to reset to base weapon)

    Player press fire 1
    + my_weapon= 0
    >>> set internal flag 0 of player on
    (this is to shoot with base weapon)


    3) launching the correct bullet

    Player flag 0 is on
    +my weapon=0
    >>>> set player flag 0 off, shoot "crappy base gun bullet"

    Player flag 0 is on
    +my weapon=1
    >>>> set player flag 0 off, shoot "shotgun bullet"

    Player flag 0 is on
    +my weapon=2
    >>>> set player flag 0 off, shoot "other weapon bullet", etc. etc.

    replicate for each weapon


    And you're done!

    I think this could be hard to follow in some parts,
    but it's quick enough to code and may be a good beginning for understanding key mechanics of Fusion

  5. #5
    No Products Registered

    Join Date
    May 2015
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks! I will upload a .mfa file!

Similar Threads

  1. Mounted body with different weapons.
    By Decoamorim in forum File Archive
    Replies: 0
    Last Post: 9th November 2013, 02:45 AM
  2. Bad Example of Switching Weapons
    By variant in forum File Archive
    Replies: 0
    Last Post: 26th January 2010, 02:16 AM
  3. Cycling through weapons?
    By JoshHarris in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 8th January 2008, 07:03 PM
  4. how to: changeable weapons etc.
    By Dariorox in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 7th November 2006, 11:33 PM
  5. How to deal with different weapons
    By Pancra in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th October 2006, 08:49 PM

Tags for this Thread

Posting Permissions

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