User Tag List

Results 1 to 10 of 10

Thread: A plodding knight who later turns into The Flash after the game's been running awhile

  1. #1
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    A plodding knight who later turns into The Flash after the game's been running awhile

    Hi guys,

    I don't know if anybody will be able to assist me with this without my exact code however if Sketchy reads this he might remember because it's essentially his

    Anyhow the gist of the code goes like this (this is for a tile-based overhead game):

    Repeat while pressing UP ARROW
    +Restrict actions for 0.22" -> move the guy 1 space up

    Repeat while pressing DOWN ARROW
    +Restrict actions for 0.22" -> move the guy 1 space down

    Repeat while pressing LEFT ARROW
    +Restrict actions for 0.22" -> move the guy 1 space left

    Repeat while pressing RIGHT ARROW
    +Restrict actions for 0.22" -> move the guy 1 space right

    What this does is moves the little guy around at a good pace, and this works just fine- until the game has been running for about 10-15 minutes or so. After that time he just turns into The Flash(-tm) and every keypress zooms him around way way too fast, almost as if the computer has started to ignore the "restrict actions for 0.22" lines. It makes the game almost unplayable at that point, as you will quickly overshoot turns and corridors and well it just sucks when this happens!

    Is this some sort of weird memory issue? Has anybody ever experienced anything similar with MMF2 and has found a way to solve / workaround it?

    Thank you!!
    Images attachées Images attachées

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm gonna be the bad guy here and say "Don't use restrict actions and default movements and just make custom movement with your own speed modifier"

  3. #3
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That's the thing though, it's not a default movement.

    I just use arrow press events to move the guy 1 tile in any of the 4 directions. I'm not sure how else you could limit the movement of an arrow key held down that'd work better than the 'restrict action' event. Any idea of what'd be better?

    Thanks!

  4. #4
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Del_Duio - I think Konidas was aiming more towards 'stop using the internal timers' lol...

    It's part of the parcel today to try and use a delta time. Set a counter to Always > Add 1 to counter. Then use a simple formula such as 'Every Key Stroke' > Set GlobalValA to counter mod 6.

    Then, player presses up + (GlobalValA=counter mod 6) then:

    This is because using the internal timers can be a bit dodgy especially if you wish to export to another platform, so it's best to use the frame rate of the application/game to define the restriction.
    Want to learn Clickteam Fusion 2.5?




  5. #5
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's a glitch that causes Upon Pressing a Key to function like REpeat pressing a Key after a lot (32768?) of frames of being held, and this could be a variation of that. Maybe the problem was just the internal timer overflowing after that many frames.

  6. #6
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I almost never use internal timers MMF has built into it.

  7. #7
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys, I didn't know about the bugs and delta time

    I wasn't able to get online last night, but I was able to make a workaround for this however it's probably super-complicated and ridiculous (but it works!)

    What I have is every time the player presses an arrow key down it sets an internal string as either "LEFT", "RIGHT," "UP", or "DOWN"

    Then every 0.05" (I know, another MMF timer though I've never had problems with them yet) a counter is incremented by 1. If that value is >=4 then it gets set back to 0.

    And THEN it checks to see if the player's pressing down a key and if he is and that counter's value is 0 then it moves the guy 1 tile.

    This worked great, however it was sluggish especially if you wanted to change directions because sometimes that internal counter's value would not be at 0. So I added this to the "move player a tile" event:

    If guy moved 'up' then set another internal string to "UP, moved 'down' set it to "DOWN", etc etc.

    And lastly if those 2 strings don't ever match (which would mean you're trying to change directions) it sets that counter to value 0 and lets the player move in another direction regardless of what that counter's value is.

    And the funny thing is that not only does this crazy way actually work, my other problem of getting stuck inside walls by pressing 2 arrows at once no longer happens. I guess this is just an interesting view of how my brain works stuff out haha.

  8. #8
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Del_Duio - 'Every' and 'Restrict By' are two different routines used. Every will only trigger once the other conditions are met. 'Restrict by' for some reason works on another routine which can fall behind with the internal timer.

    Glad to see you got it working, however I would for future developments sake look into using the game's Frame Rate to define such restrictions.
    Want to learn Clickteam Fusion 2.5?




  9. #9
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Will do, thanks Danny!

  10. #10
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    LOL... Del, that is like the most convoluted way of doing a movement system that I've ever seen. :p

    You should really check out my fastloop movement example. There's a link to it in my signature.

Similar Threads

  1. What MMF2 flash build am i running?
    By King_Cool in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 20th August 2013, 06:11 AM
  2. Error running game in Flash version....
    By KLiK-iT in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd October 2012, 10:51 PM
  3. 'Is application running in Flash' condition?
    By Ryan in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 6th April 2011, 01:19 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
  •