User Tag List

Results 1 to 6 of 6

Thread: Slow down subtraction from a counter?

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Slow down subtraction from a counter?

    I've got a counter as an energy bar. While overlapping actives with "enemies" as a qualifier I subtract 1 from the counter. Unfortunately this is rather too quick and the player looses all lives very quickly. So I used a timer in the same event. Every 1 second subtract 1 from the energy counter. This works better but it's possible to collide with an enemy and not lose any energy (because the collision occurred between seconds).

    How do I slow down the subtraction from the energy bar counter without using a timer then?

  2. #2
    Clicker Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Jokk3's Avatar
    Join Date
    Dec 2013
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To subtract slowly from counter (that is not your problem):
    You could do it so that collision adds to "damage to energy" variable. Every time tick of your choosing, IF "dmg to energy">0, you subtract 1 from energy and 1 from "dmg to energy". Than you either make it so that player can die if "dmg to energy" is greater than remaining energy, or only when energy bar is visually drained (allowing player short time to find health and avoid death).

    To restrict enemies dealing damage(this is your real problem):
    You need to make it so that after attack, either player can't take damage for certain amount of time OR enemy that damaged player can't deal damage for certain amount of time.
    You could make it so that either enemy or player bounces enough to not touch for a while.
    You could use "only one action when event runs" - but I don't think it will work in this case.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's not quite what I meant. Here's a quick vid I made: https://youtu.be/5bp_P3lvb1A

    So basically the player doesn't attack anything - it's a Dizzy style puzzle platform game - the player only has to dodge/jump over certain bad things. While colliding with those bad things I have the energy bar reduce by a value of 2, this is because my graphics have to look like the Commodore Amiga (or as near as I can manage it, I'm not much of an artist!). All the graphics use 2x2 pixels therefore the energy bar has to conform to this rule. You can see in the video the energy bar reduces far too quickly.

    Then I set the value to 0.2 instead. This is better, the bar empties much slower but no longer conforms to the 2x2 pixel rule for the graphics.

    I'm thinking maybe I'll be better off using an active object for the energy bar with animated frames and when it reaches whatever frame (empty bar) subtract 1 life and respawn the player. At least I'll have more control over how the bar looks.

    FYI I haven't finished setting up respawns yet so the player isn't respawning in this test.

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    aenever's Avatar
    Join Date
    Jun 2013
    Posts
    1,439
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    You probably need to add a condition only one action when event loops. What's probably happening is that for the entire time the flame touches the player it subtracts rather than an amount on each hit

  5. #5
    Clicker Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Jokk3's Avatar
    Join Date
    Dec 2013
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, do you convert damage and hp so that they work in the same resolution as the bar? If not, that is something you need to fix.
    For example if player has HP of 100 and energy bar has resolution of 2 pixels, it would easy to make a bar that is 200px wide and just double the HP when passing it to the bar. However if the bar needs to be 64px and HP 330, you got harder case.

  6. #6
    Clicker Multimedia Fusion 2

    Join Date
    Feb 2007
    Location
    UK
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I used an active with animation of the health bar going down. When the player is overlapping a bad thing the animation plays (energy bar goes down). When the player is not overlapping a bad thing the animation stops. I've also got a restore event when the player dies so the animation repeats when next colliding with a bad thing. It works great and conforms to the 2x2 pixel rule - plus I can be a bit more creative with how the energy bar looks.

Similar Threads

  1. Replies: 1
    Last Post: 5th November 2015, 04:20 AM
  2. rpg subtraction
    By TheCrimsonTaco in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 6th December 2013, 12:43 AM
  3. Adding Half a Counter's Value to Another Counter
    By soloman in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 28th June 2010, 11:30 AM
  4. Overlay Subtraction and Addition operations
    By LazyCoder in forum Extension Development
    Replies: 2
    Last Post: 18th October 2007, 01:48 AM
  5. Big Bug my ufo slow down and application slow down
    By DJ_Wild in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 12th October 2007, 05:58 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
  •