[FENIX] more colors

Started by MisterN, June 15, 2011, 12:31:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

werg

Sandman

The level_graph should be a valid graphic. You need a valid graphic for the front graphic of the scroll. I don't remember all quirks of Fenix, but bad error reporting was one of them. Also check out start_scroll() on the wiki.

Some general tips for debugging:
- insert say() statements to check what line goes wrong
- insert verification checks for arguments you pass to functions (for instance, you could do if(!map_exists(...)) /* handle/report error */ end on that level graph and this would catch the error)
- back trace from the point where it went wrong to find out what caused the error
-- Sandman

MisterN

that ade no sense :s i contacted this russian guy maybe hell figure it out but that made absolutely no sense. i cant just take what you showed me and apply it to my code because i dont know where and how i should do it. a little more meat on the bone would allow me to understand, yes?
werg

handsource-dyko

Yeah those error messages. Older versions of fenix (the 0.84 versions) where notoriousely buggy too. I have bitter sweet memories to that version in particulair, because it was the only version with gui.dll wich was nice addition that wasn't developed any further, but it was completely undocumented and very quirky. (It wasn't very hard to make it crash).

MisterN

Actually I have the latest version of fenix for dreamcast which is the latest version of fenix. What sucks is in order to run the program you need a file manager but ive been talking to the russian guy who ported it hes working on bennu as well.
werg

MisterN

werg

FreeYourMind


MisterN

Ive been trying to get this to work! Jesus Christ... I wanna load them levels from .txt files ive been trying for a month straight. But nothing is working.
werg

FreeYourMind

Man xD And how you make the levels ?  :D

handsource-dyko

How exactly are you loading the levels?
Reading data from a text file and putting it in a structt is not very hard, but still I recommend
binary files for the level data itself (kinda requires an working leveleditor), but you can also
save data from a predifined struct to a file. On the wiki there should be some examples of the
load/save routines with structs.

http://wiki.bennugd.org/index.php?title=Load
http://wiki.bennugd.org/index.php?title=Save

MisterN

Heres the link to my game
http://www.mediafire.com/?76bbpebs9pss9wa
that should sum things up. I may or may not have changed the code back to the levels being loaded in the engine itself but im not sure. The first process is either scroll() or level() either way they are the same thing, I just cant remember which one I named it to when I made the .zip. I want to make it read this .txt file simply places all the objects (collectibles, player, enemies, etc) and makes the level image and mask (which are .png files anyways, it just places them on the screen) and inside that .txt document i want a code there that when the player runs into this object (next_level, or previous_level) it changes to the next (or previous) .txt file (which is the next/previous level). Ill take a look at the save and load thing but take a look and see if what I have invisioned will work.
werg

MisterN

Yeah I tried the load and save thing it worked without errors but it loaded blank nothingness and the error no scroll 0:0 of doom. please help
werg

handsource-dyko

Quite obvious that it doesn't work. I looked at the textfile level1.txt
You should not put code in it, just only put the path with filename in it, like this: sprites\level\image\testlevel-1.png.
Then read it with the fgets() function. This function reads just one line of text form a textfile, and it returns the string of text it read.

Don't use fread on textfiles.

Try this to change it into this:


//This process is for all the levels, menu's, and cutscenes
Process scroller ()
Private

    int handle;   // handle for the loaded file
    int level; // here's where the loaded data go
    string path;

Begin

handle=fopen(".\rooms\2_Level\level1.txt",O_READ); // opens the file in reading mode
        path=fgets(handle);
fclose(handle);                // zipping up after business is done
        write(0,0,0,0,level);       // shows the value of level

        levelgraph=load_png(path);
start_scroll(0,Player_graph,level_graph,0,0,1);//starts the scroll, variables:

etc etc etc etc


Anyway change the file level1.txt form

Process handle ()
level_graph=load_png(".\sprites\level\image\testlevel-1.png");
end


into only this (so only one line of text):


sprites\level\image\testlevel-1.png



You can add more lines of text, fgets reads the current line when put in a loop.

MisterN

#43
http://www.youtube.com/watch?v=P3ALwKeSEYs
Thank you now I added it to my real code (the code I keep secret :3) Thus making the game almost done, now all thats left is:
*pause menu
*playing fmv cutscenes (if thats even possible)


But thats all last minute stuff like always, all the levels have been done, all the enemies have been done, but now that i have an easy way of loading and unloading the levels externally (instead of through the engine) that should make the programming much easier

If I wanted to, could I put in the corrdinate for all the things that will appear in the level and will the unload when that level is done? ill have to do some experimenting. But thanks
werg

handsource-dyko

Quote
If I wanted to, could I put in the corrdinate for all the things that will appear in the level and will the unload when that level is done? ill have to do some experimenting.

Yes, this is possible, in several ways.
You could add more lines in your textfile where each line represents some value (the order of the data matters).
Or you could use the load and save routines on structs. Be carefull though, if you add variables to a stuct later on, you have to resave
the file because load and save routines expect the data to be in a certain order with a certain size. My guess is that strings are saved in a special way.