Arrays to store levels
CAnesia last edited by
Well I’m tackling again hyperPad by developing more on a project started in spring.
- main character is a water H2Ow blob
- can change its states only by the influence of external elements
- states are: liquid (water), solid (ice) and well gas (vapour)
- each state gives the character different abilities:
Water - can pass filters and flow trough pipes, etc.
Ice - will slide and is solid so it can pass above absorbent surfaces
Vapour - rises so it passes above all the obstacles
Navigate the level maze towards the exit point in the shortest time possible while collecting as many points as possible
- driven by left/right/up/down while touching arrows
- it moves on a tile grid, one at a time, constant speed (according to the current state)
- will always start in water state
What is the best approach for something like this?
Arrays: besides storing the game levels layout in them what else can/should I store in them that applies to my game (points locations, exits, traps, bonuses, etc.)
How would I append them and would I access them?
Any hub projects examples?
Any forum posts that you remember?
Aidan Oxley last edited by Aidan Oxley
@CAnesia Are objects in your levels confined to a specific grid, or just sitting around in random positions? This would determine whether you have an array that saves an ID for every spot on the grid (0 being for nothing, 1 for exit, 2 for some specific powerup etc), versus having an array with multiple arrays inside it to store every position of every object.
CAnesia last edited by CAnesia
@Aidan-Oxley the game layout (scene) has a grid look and feel, every cell in my grid needs to be filled with one graphic picture accordingly, the graphic ID should be contain in the Array and based on that to be loaded at its coordinate point on screen.
I just realize that this generates a question: if one Array contains the graphic ID then another Array should contain the x/y coordinates for every graphic ID or I can store all this in 1 Array only?
A visual representation of my populated grid Array would be: (w=walls, c=clear path, t=traps, e=exits, p=points)
. 1 2 3 4 5 6 7 8 9 0
Is this even a correct representation of a Array?
Here is a link for the game preview link text
Kamdroid last edited by Kamdroid
@CAnesia This is possible, but you’d need to write your own parser, and that’s kinda messy for most people.
EDIT: Might not need to worry about the below, as your game uses big tiles:
However, I asked HyperPad developers whether having HyperPad have each individual tile as an object is a good idea and they said no.
They told me in the future they’ll implement a “tile” object, which will allow you to have individual tiles in HyperPad without sacrificing fast loading or game performance.
CAnesia last edited by
@Kamdroid Thanks for the advice!
I see hyperPad oftenly strugles with performance, I designed my level using individuals graphics for every tile since I used free graphics for the most of them. I also thought individuals small size (file weight) graphic tiles will be easier to load. I am not sure of it, I could easily design my level layouts as one big file and drop it in as a background picture.
What do you mean about parser? There is no behaviour in hyperPad that reads a Array and act as/contained values? If not what is the point of having an Array?
I am very confused about the best approach, and now I have a question daunting me:
So my walls graphic in Array is identified as “w” so I will have a graphic wall object named “w” imported only once in the scene and then what? The array reads every key and when hit a “w” will duplicate the graphic of the original “w” ... I do not see the behaviour logic yet, for sure I need to test and see what works and what doesn’t.
Aidan Oxley last edited by
@CAnesia Ok, because of it being grid like, I would as you said assign a short 1 symbol ID for every possible object, and then have an array that stores all of these and loads the level in a specific order. I only make it load the same as reading (left to right, top to bottom). If you don’t know how to make a level loader, I can probably help you make it by either making an example project or editing your actual project