User Tag List

Results 1 to 2 of 2

Thread: Irregular grid size, most efficient way to implement "sprite scaling" type visual

  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
    Aug 2020
    Location
    Canada
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Irregular grid size, most efficient way to implement "sprite scaling" type visual

    Hey everyone

    Just wondering if I am doing this the best way.

    I have a 3x3 "grid" that an object moves on with the bottom row being the "front" and the top row being the "back" and the object shrinks or grows based on which row it is in to give the illusion of depth, similar to those old sprite scaling games like Space Harrier. Since the "cells" on the grid at the back get closer together on the X axis with each row towards the back, the grid has the shape of a trapezoid.

    ---*-*-*---
    --*--*--*--
    -*---*---*-

    I was having trouble thinking of a way to implement movement of the object within this trapezoidal grid in the cleanest way possible. The objects in the grid don't need to move smoothly, they are "snapped" to each cell. The player moves horizontally along the bottom of the grid (an extra 4th row with the same X values as the "front" row of the grid above mentioned grid)

    Controlling the size of the object is no problem, a simple if y=## then set size of the sprite on the active object

    The objective is to:
    - allow the scaled object to detect if there is an object existing in any adjacent cell of this 3d grid
    - allow the object to move to an unoccupied adjacent "cell" if possible
    - allow the object to perform an action if it is, say, lined up with the player, or adjacent to the player, or some other condition

    Right now I use an array, with 2 z layers:
    1 - to keep track of occupied spots, and what is occupying them
    2 - to dictate the X,Y coordinates of each "Cell" on the play area


    I had an idea to use the advanced gameboard object, placed out of the play area, instead of the array to accomplish "1" above. So the object in the gameboard grid would be what moves (out of sight) and the object in the play area on the "3d" grid would just have its position updated to the irregularly sized "3d" grid. I am leaning towards this because I think for this purpose the advanced gameboard is a bit more straightforward to manage and has built in ability to detect occupied cells etc. That does require a bunch of additional objects though

    I like to make things as clean and efficient as possible though so doing this with the least # of objects and lines would be best, so just looking for any better ideas of how to accomplish this or maybe I have it figured out, if so that is great.

    Also I would like to say I have done a few posts here and everyone is so helpful, it's really great. Cheers

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    1,159
    Mentioned
    199 Post(s)
    Tagged
    0 Thread(s)

    The objective is to:
    - allow the scaled object to detect if there is an object existing in any adjacent cell of this 3d grid
    An easy way to do that is to create a dummy or placeholder object that is invisible. If the player wants to move right - create the placeholder object to the right of the player, for example create it relative to the player X + 32 (32 being the size of the square).
    If the placeholder overlaps another object, the player can't move, just destroy the placeholder object.
    If the placeholder doesn't overlap another object, move the player, destroy the placeholder object.
    Your placeholder object needs to be smaller than the player and placed far enough that it doesn't overlap the calling player.



    The objective is to:
    - allow the object to perform an action if it is, say, lined up with the player, or adjacent to the player, or some other condition
    You can again control this with placeholder objects, for example create a placeholder above, below, left and right of the player. If they overlap then switch a flag on.
    If the player's flag is on - then perform the action, turn the flag off.

    For example:
    If you wanted the player to have a buddy on the left and right for an action you would do it in two steps:
    1. Create a placeholder object to the left of the player
    2. If it overlaps then create a placeholder object to the right if the player. If that one also overlaps - turn the flag on.
    (if there's no overlap, then the sequence of events stops and the flag is not turned on - i.e. nothing happens.)


    But in Fusion there are always many ways of achieving a result - if what you have is working for you, then go with that.

Similar Threads

  1. how can i set "Compile Source As" to " According to file type" ?
    By naiking in forum iOS Export Module 2.5
    Replies: 1
    Last Post: 10th March 2019, 07:33 AM
  2. "Burn in" visual bug in objects with transparency
    By 9VoltWiseman in forum Fusion 2.5
    Replies: 1
    Last Post: 30th August 2018, 08:50 AM
  3. Replies: 5
    Last Post: 13th May 2016, 08:54 PM
  4. Efficient "Text Adventure" Events
    By Soilydude in forum Fusion 2.5
    Replies: 4
    Last Post: 1st April 2016, 05:19 PM
  5. problem with visual studio "unsupported"
    By wanbarbosa in forum XNA Export Module 2.5
    Replies: 0
    Last Post: 30th January 2016, 07:33 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
  •