User Tag List

Results 1 to 4 of 4

Thread: The "canMove" function

  1. #1
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,615
    Level
    25
    vBActivity - Bars
    Lv. Percent
    0.44%

    The "canMove" function

    Saffith uses the "canMove" function, which I presume checks whether a given location is walkable on layer 0. I'd like to use this function too, but I don't see it posted anywhere.

    Any clues?

    EDIT - Nevermind, I found it.

    // Check whether the trap can move into a certain tile.
    // Returns true if the tile on layer 0 is within the
    // range of the screen and no part of it is solid.
    bool canMove(int x, int y)
    {
    if(x<0 || x>240 || y<0 || y>160)
    return false;

    return Screen->ComboS[y+(x>>4)]==0;
    }
    }

    EDIT 2 - Aaaaand now I'm getting an error message that "screen" is undefined. What the...

    EDIT 3 - Apparently the "screen" pointer can only be used INSIDE an ffc script. It cannot be placed in a global function.

  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.63%

    Re: The "canMove" function

    I'm guessing it doesn't like where you put it:
    Code:
    ffc script foo
    {
       void run()
       {
       }
    
       // Here is fine
    }
    
    // Here, outside of the script, Screen is undefined
    // I believe the same is true of Link and Game
    (Edit: Ah, beaten to it.)

    By the way, that function returns false if any part of a tile is unwalkable, not if that exact point is. I've been meaning to work out a more precise version, but I haven't done that just yet.

  3. #3
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,615
    Level
    25
    vBActivity - Bars
    Lv. Percent
    0.44%

    Re: The "canMove" function

    Thats good enough. Im working on the charging Moblin boss and wall-hugging spark from Link's Awakening, and they stick with a grid.

  4. #4
    Administrator DarkDragon's Avatar
    Join Date
    Oct 2001
    Posts
    6,228
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    11,031
    Level
    31
    vBActivity - Bars
    Lv. Percent
    8.9%

    Re: The "canMove" function

    Quote Originally Posted by C-Dawg View Post
    EDIT 3 - Apparently the "screen" pointer can only be used INSIDE an ffc script. It cannot be placed in a global function.
    There's no reason this must be true, and should be fixed.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social