User Tag List

Results 1 to 6 of 6

Thread: How can I reuse my code for a weapon / sprite switching

  1. #1
    Clicker Fusion 2.5

    Join Date
    Aug 2014
    Location
    Hawaii
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I reuse my code for a weapon / sprite switching

    Hey CT,

    I'm looking for a Contra like (NES) example of weapon / sprite switching. Basically, if the player collides with an active box "S", they get shot gun, "L", laser, etc. and thus the active the shoot is now either a bullet or a laser or a whatever else I come up with.

    I found an example by popcorn here that is close, however, his example doesn't do the one thing I need to figure out: which is switching the weapon / sprite. In his example, its the same bullet / sprite being used in all three weapon types. I'd like to change the actual active "bullet" sprite / weapon itself that's being fired. In this case, if they pick up an "L", the sprite is now a long blue line (or whatever I make) that represents a laser shot, etc.

    I currently have code to shoot one type of active, preferably, I'd like to reuse that code for any other weapon type that the player may get.

    Hope that makes sense,

    Thanks!

    Wiggy

  2. #2
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Ziplock's Avatar
    Join Date
    Oct 2013
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Popcorn's example uses a counter to determine which weapon type is being fired. Couldn't you, ostensibly, use the same counter to change the animation of the bullet?

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im assuming you have a value representing the current weapon in hand ( ValueW ).

    Suggestion:
    Make each bullet, uppon its creation, check what the current weapon is, and then change its animation accordingly.

    Code:
    - If Bullet Flag0 is OFF + ValueW = 1
    -> Bullet change animation to Shotgun

    - If Bullet Flag0 is OFF + ValueW = 2
    -> Bullet change animation to Laser

    and so on...

  4. #4
    Clicker Fusion 2.5

    Join Date
    Aug 2014
    Location
    Hawaii
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ziplock / King_Cool

    I've been looking at this and I think I got it, once it works I'll let ya know which way I went. Thanks again for the responses, this is just what I needed... a starting point !

  5. #5
    Clicker Fusion 2.5

    Join Date
    Aug 2014
    Location
    Hawaii
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pretty simple, I went with a new animation, pretty cool. Now I don't need different actives for every weapon type... But now a new issue. The problem now is that all the projectiles (missile, bullet, laser, etc.) all have the same speed. I'm going to try and make a global or perhaps an alterable variable for the "projectile".

    Am I on the right track to change the projectiles speed (or other attributes)?

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes your on the right track.
    Use AlterableValues, not GlobalVales.
    Reason being, when you compair to an AltValue, the Event doing so knows what 'specific' bullet the Event relates to.

    Example:
    BulletSpeed_ ( altVal ) > 100 -> Destroy Bullet
    ^ This will destroy only bullets having speed greater than 100

    BulletSpeed_ ( globVal ) > 100 -> Destroy Bullet
    ^ This will destroy ALL bullets if ANY have a speed greater than 100

Similar Threads

  1. Many lines of code = issues with code firing in order?
    By GamesterX23 in forum Fusion 2.5
    Replies: 4
    Last Post: 5th July 2015, 07:31 PM
  2. Weapon use tutorial or example?
    By gamer123 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 16th June 2012, 10:38 AM
  3. Character Weapon Switching on the fly? {With PMO}
    By darkmanx_429 in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 16th April 2012, 02:30 AM
  4. A few weapon problems!
    By RealGameMaker in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 20th August 2009, 06:45 AM

Posting Permissions

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