Need Help With Platformer


iprice said:
You're so right about FBMX being buggy - sometimes it works then other times it doesn't!!! Terrible.

I have discovered that it is to with how you have set up the multi-dimensional array - if you change one value to a number other than 0 or 1 (say 4) you will see that "4" will appear more than once in your display if you use a WRITE command to display the value of that array, rather than a PUT command. This is obviously wrong.

I'm not sure you can declare a mutli-dimensional array the way you are trying to.

You are going to have to load your data into the array either one at a time - (like I did with the four corners), or use an external file to hold the data and read it all in.
Yeah, I figured it had something to do with that. I couldn't find any information on the net about how to set up multi-dimensional arrays in Fenix. In C++ I would just put brackets around each line and another set of brackets around everything. Fenix won't recognise { } though.

I'll try to read it into the array one at a time or textfile loading, thanks.

EDIT: Thanks for the solution, I'll try it right away. :)
 
Last edited by a moderator:
It's working, thanks for all the help!
Just one more question though.

How would I handle loading different levels? Or rather, how would I "unload" the current level and replace it with another one in a good way?
 
If you had all your levels stored as level2[]=xxxx and level3[]=xxxx etc. then you could use the FOR loop as before -

CODE

n=0;
for(y=0; y<15; y++)
for(x=0; x<20; x++)
lvl[x][y]=levelX[n]; // <--------Change the level number here

// Or make Level a multi-dimensioned array
// lvl[x][y]=level[level_number][n]; etc...

n++;
end;
end;



Personally, I always make level editors for my games and load the data in as required, rather than hard code it - the choice is yours though.
 
iprice said:
If you had all your levels stored as level2[]=xxxx and level3[]=xxxx etc. then you could use the FOR loop as before -

CODE

n=0;
for(y=0; y<15; y++)
for(x=0; x<20; x++)
lvl[x][y]=levelX[n]; // <--------Change the level number here

// Or make Level a multi-dimensioned array
// lvl[x][y]=level[level_number][n]; etc...

n++;
end;
end;
Yes, but I would need to change the level once in the game loop. (for example by checking keypress or when touching a specific "goal" tile.
So I would need that for-loop to run again and change the level. But putting it in the game loop would loop the for-loop forever, no?

iprice said:
Personally, I always make level editors for my games and load the data in as required, rather than hard code it - the choice is yours though.
I probably will, eventually. But I like to start simple and then make things better as I go along.
Haven't even thought about how to build an editor yet, could be a fun experience if I succeed. :)
 
Last edited by a moderator:
You don't have to put the FOR loop into the main loop - put it into a process/function of it's own and then call the process when required. :)

You didn't ask where to implement it, you just asked how to implement it;) :p

Level editors are surprisingly easy to create, give me a yell when you are ready to go that route. :)
 
iprice said:
You don't have to put the FOR loop into the main loop - put it into a process/function of it's own and then call the process when required. :)

You didn't ask where to implement it, you just asked how to implement it;) :p

Level editors are surprisingly easy to create, give me a yell when you are ready to go that route. :)
Sure, thanks for offering help. :)
 
Last edited by a moderator:
Ok, I think it's time to think about a map editor now.. And I think I'll make it a separate program and not built-in. (don't want the user to be able to edit the maps, it's just for me the developer. and preferrably the files Fenix writes and reads should not be easily editable through a texteditor by the user either but it's not as important at the moment)

So the map editor should be able to write and read files for saving and loading. Cycle through the available tiles and paint them on screen (either by mouse or keyboard). Anything I forgot?

I'm not really sure how to pull this off on my own, so I might need some help on where to start.
At the moment I'm checking out a C++ example from here: >http://www.parallelrealities.co.uk/tutorials/intermediate/tutorial13.php

Will try and adapt that to Fenix and hope for the best. But feel free to help me out if you have experience in this.

EDIT: I sorted it out, got a fully working level editor now. :D
 
Last edited by a moderator:
Back
Top