User Tag List

Results 1 to 4 of 4

Thread: Quantized/Step Movement?

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quantized/Step Movement?

    If your moving a active with the mouses Y position whats the best way to snap it to every 20 etc in a quantized/step movement rather than just moving by 1 each time like normal?

  2. #2
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quantized/Step Movement?

    If you set an object's y position to round(ymouse / 20) * 20 it will round the position to the nearest 20.

  3. #3
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quantized/Step Movement?

    Its to set 2 variables.

    One is the position of the current step,

    The other one is which direction it's going.


    Then you say.

    +if StepPosition is greater then 0
    +if StepDirection is equal to "up" (or "1")
    -subtract 1 from active(y)
    -subtract 1 from StepPosition

    .. exe for down left right (what ever else)

    (Then to control this walking engine say)

    +if StepPosition is equal to 0
    +if KeyPressed "up arrow"
    -Set StepPosition to <Step size>

    .. exe for down left right (what ever else)


    Just an intuitive guess :P

  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quantized/Step Movement?

    Thanks everyone, Dynasoft's code was just what i needed for this. It's working fine although i have found a slight problem after expanding on it slightly. What happens now is i needed to offset the starting position of the active thats always moving with the mouse and quantized so i also added -

    (Item Size( "Active 9" )/4.0)

    This positions it perfectly as im overlaying it on another object thats position that can change and it works however the problem is the offset is applied to the quantized movement also so when it jumps to the next tile/value it does it with the offset. So what i want is say if it's 0-20 each step made it currently changes at about 15 but i need to have the switch at 20.

    The condition is Always and the full expression is -

    Round(YMouse/Item Size( "Active 9" ))*Item Size( "Active 9" )+(Item Size( "Active 9" )/4.0)

    The Item Size = 20

    Does anyone have any suggestions to fix this or a idea on how to apply the offset but keep the movement so it always moves with the Mouse Y without the step switching before it should? thanks for the help

Similar Threads

  1. Wanted: A LOT of step-by-step tutorials to create games (just like Chocobreak).
    By puzzele in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 31st August 2015, 05:18 PM
  2. Chartboost Extension - Step by Step How-to document
    By Jeff in forum Android Export Module Version 2.0
    Replies: 30
    Last Post: 18th September 2013, 11:30 AM
  3. step by step tutorial for using iOS Export?
    By rubes in forum iOS Export Module Version 2.0
    Replies: 5
    Last Post: 25th February 2013, 04:04 PM
  4. Step by Step Tutorials for Extension Development
    By Stephen in forum Extension Development
    Replies: 17
    Last Post: 31st March 2009, 08:54 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
  •