User Tag List

Results 1 to 4 of 4

Thread: Grid Based Movement Query

  1. #1
    Clicker 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)

    Join Date
    Mar 2016
    Location
    England
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Grid Based Movement Query

    My games usually use a mouse based interface but I was experimenting with a grid based setup using a key based input as some variation. As a little test I sat down and followed a popular YouTube tutorial for smooth grid based movement and obstacles:



    Aside from mapping to the arrow keys (1=Up, 2=Right, 3=Down, 4=Left) instead of ADSL and swapping a 32 pixel grid for a beefier 95 pixels, I've followed along exactly as a learning exercise.

    Annoyingly however, there appears to be pixel creep, which means that not only is my 'Player' object moving off grid, but that all my 'Wall' object details (preventing movement) fail to act as solid elements to prevent movement.

    I've re-watched the tutorial 3 times since the original step by step and can't work out where things have deviated and know that the community here always offer fantastic feedback.

    I've linked the file from dropbox as a .rar here.
    https://www.dropbox.com/s/w9ozd31m98...ement.rar?dl=0

    Can anybody spot the problem?

  2. #2
    Clicker 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)

    Join Date
    Mar 2016
    Location
    England
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To elaborate (using just upward movement as an example) there are only 3 elements to this movement test. A background object that is a 95x95 grid, 'Wall' which is an active object, and 'Player':

    'Player' has 4 Alterable Values.
    1 - Tile Size (95)
    2 - Pixel Count (0)
    3 - Pixel Speed (3)
    4 - Direction (0)

    There are 4 Groups in the event editor.

    Controls:
    Direction of 'Player' = 0 + upon pressing the up arrow: Set Direction of 'Player' to 1.

    Movement:
    Direction of 'Player' = 1 + Pixel Count of 'Player' is below tile size: Add Pixel Speed to Pixel Count. Set Y position of 'Player' to - Pixel Speed of 'Player'.

    Stopping:
    Direction of 'Player' = greater than 0 + Pixel Count of 'Player' is greater than the tile size: Set Pixel Count to 0. Set Direction to 0.

    Direction of 'Player' = 1 + Pixel Count of 'Player' is greater than the tile size: Subtract Tile Size of 'player' from Pixel Count. Set Y position of 'Player to + Pixel Count of 'Player'. Set Pixel Count to 0. Set Direction to 0.

    Walls:
    Direction of 'Player' = 1 + 'Player' is overlapping 'Wall': Set Y position of 'Player to - Pixel Count of 'Player'. Set Pixel Count to 0. Set Direction to 0.

    (obviously the above is repeated for directions 2,3,4 as right, down and up respectively)

    Can anybody see any faults in this logic?

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Norway
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    I have found a few problems, after correcting them it all seems to work fine.

    1. Event 17 under stopping is preventing the events 18, 19, 20 and 21 for firing. This event will never fire, because the event 17 will fire if direction is above 0 (Pressing any direction) and Pixel Count is above 0, and then just setting Direction and Pixel Count to 0. This means the event below will never fire because Direction and Pixel Count is now 0. I have disabled this event.

    2. Event 19 under stopping is set to set the X Position of the player to: X( "Player" ) + Pixel Count( "Player" ). But the correct expression is to subtract here. So I have set it to: X( "Player" ) - Pixel Count( "Player" )

    3. Event 21 under stopping is set to set the X Position of the player to: X( "Player" ) - Pixel Count( "Player" ). But the correct expression is to add here. So I have set it to: X( "Player" ) + Pixel Count( "Player" )

    4. Event 24 under walls is set to set the Y position to: Y( "Player" ) - Pixel Count( "Player" ), but the correct expression is to add here. So I have set it to: Y( "Player" ) + Pixel Count( "Player" )

    5. Event 26 under walls is set to set the Y position to: Y( "Player" ) + Pixel Count( "Player" ), but the correct expression is to subtract here. So I have set it to: Y( "Player" ) - Pixel Count( "Player" )

    See attached mfa.
    Attached files Attached files

  4. #4
    Clicker 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)

    Join Date
    Mar 2016
    Location
    England
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Decal. It's very much appreciated that you took the time to look this over.

Similar Threads

  1. Grid movement based follower npc help
    By Little7om in forum Fusion 2.5
    Replies: 1
    Last Post: 21st March 2017, 06:32 PM
  2. Grid-based movement
    By AndyCapple123 in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 12th May 2013, 08:07 PM
  3. Grid Based Movement - Contest Entry
    By Jacob in forum Widgets
    Replies: 9
    Last Post: 6th February 2010, 01:41 AM
  4. Enemy collisions for a Grid based movement
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd January 2010, 07:32 PM
  5. Grid based enemy movement
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th October 2009, 08:34 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
  •