I want to begin making a maze for my game but I have some problems

Not favoritedFavorited Favorited 1 favourites
  • 10 posts
From the Asset Store
Ball maze is a mobile game, where you have to win the maze.
  • At the current state of my test, each cell of the array is hidden. When the player goes inside a cell, it is revealed, alongside its properties. Each cell currently has 4 important values, one for its top, bottom, left and right. Depending on the number of the value the Cell will either display a door, a wall, or nothing (there can be 1 way doors this way if lets say the first Cell was a door on its right and the second has a wall on its left). The Game properly makes the Cell visible but for some reason it fails to properly load the cell properties, like sometimes I may walk randomly and some properties (which are not correct) will spawn on blocks far away from me, or end up not spawning at all.

    I will unfortunately provide a discord link for my file

    cdn.discordapp.com/attachments/960278860161765436/1329976488862416969/maze_test.c3p

    could anyone perhaps take a look and tell me what I am doing wrong?

    (do not ask why I can move through walls because this is a very very early test)

    I am also planning to add another value that will be responsible for a different maze layout each time it changes

    Tagged:

  • I don't understand the purpose of the array. Your array is empty and you don't fill it with any values!

    To fix the bug, add "For each maptile" in event 32

    + maptile: Is discovered
    + System: For each maptile
    + maptile2: id = maptile.id
    + maptile3: id = maptile.id
    + maptile4: id = maptile.id
    + maptile5: id = maptile.id
    

    Also, instead of linking by id, use the hierarchy feature, it will make things easier. And families.

    Player movement events are also very inefficient. Instead of re-calculating the id on every step, simply check which tile the player is overlapping.

  • The bug did got fixed, I am not very experienced with construct3 when it comes to arrays so forgive me

    You are telling me I can do this without using an array? I'd like to know how, since this is a very early design and I will probably redo everything.

    I will eventually add another value that determines the room, so if I change room the entire maze changes layout and gets undiscovered, if I return to the previous room the game will remember whatbwas discovered

    From the thought of this in the end I may need to use an array for this. And for such array I will make an array file now that I learned more about them

  • You are not storing anything in the array, you are basically only using it to count from 0 to 5. You can do the same with two nested "for" loops:

    For "x" from 0 to 5
    For "y" from 0 to 5
    .. Create maptile at (loopindex("x")*maptile.Width)+100, loopindex("y")*maptile.Width)+100)
    

    Or simply place all maptiles manually in the editor and iterate them with "System for each" loop.

  • Alright, this time I used an array and it now has a purpose, if the array's cell value is 1 the game will know the cell was discovered before (this for when I manage to add another maze with a different Z value). I want to make the player rotate when he presses left and right, and when he presses up he will move forward, however for some reason it didnt work when in the other test it did. Also since I coded everything in a different way I cannot seem to be able to make the discovered cells visible with the player as of right now and I need some help.

    cdn.discordapp.com/attachments/960278860161765436/1331312902988369971/TheBetterMazetest.c3p

  • You have two player instances on the layout, this can cause all sorts of bugs.

    I suggest using the debugger (Shift+F4), it's absolutely essential in a complex game like this.

  • I finally made the player move properly,thank you for telling me about Debug. I would like to ask how I can make the player's direction value loop from 0 to 3, because I want to make it so if you pressthe down button it adds 2 and my current code would make it work weirdly

  • how I can make the player's direction value loop from 0 to 3

    You mean after 3 it should become 0 again? You can do this in one expression:

    Set direction to (direction+1)%4
    

    or

    Set direction to (direction=3 ? 0 : (direction+1))
    
  • Thank you so much for everything, the maze works very fine and I can now add whatever I want in it, however I am trying to set the value of every discovered cell to 1 so if I change between 2 mazes the game will remember what was discovered or not. I tried using set xyz but it didn't seem to work based on debug.

    cdn.discordapp.com/attachments/960278860161765436/1331660326151655424/TheBetterMazetest.c3p

    everything else seems to work perfect

    also you can save arrays in locl storage right? I have done it with on item missing and on item get but for arrays I don't know how it is done

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Array.CurX/CurY expressions only work inside of "Array for each element" loop. You probably need to use X:player.playerX, Y:player.playerY in "Set at XYZ action".

    Local storage simple implementation:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)