Cargue más que variables de estructura

Started by MisterN, January 22, 2012, 02:12:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

Cuando cargo una estructura:
load("derp.lvl",levelmap);
Carga solamente las variables. Ejemplo:
levelmap.playerspawnx = 32; levelmap.playerspawny = 176;
trabajos para:
scroll[0].camera=Player(levelmap.playerspawnx,levelmap.playerspawny);
pero
levelmap.level_graph_path = load_png("./LEVEL/LEVELS/a2_s1.png");
levelmap.level_mask_path = load_png("./LEVEL/LEVELS/a2_s1_mask.png");
levelmap.level_back_path = load_png("./LEVEL/BACKGROUNDS/snow_mountains_day.png");

no trabaja para
levelmap.level_graph_path = load_png("./LEVEL/LEVELS/a2_s1.png");
levelmap.level_mask_path = load_png("./LEVEL/LEVELS/a2_s1_mask.png");
levelmap.level_back_path = load_png("./LEVEL/BACKGROUNDS/snow_mountains_day.png");

y viceversa. Aquí está el código enter:

FUNCTION level_5(topx,topy,botx,boty)
begin
z=255;
levelmap.can_pause = true;

    load("derp.lvl",levelmap);
   
    levelmap.level_graph_path = load_png("./LEVEL/LEVELS/a2_s1.png");
    levelmap.level_mask_path = load_png("./LEVEL/LEVELS/a2_s1_mask.png");
    levelmap.level_back_path = load_png("./LEVEL/BACKGROUNDS/snow_mountains_day.png");
        level_graph = levelmap.level_graph_path;
        levelmask = levelmap.level_mask_path;
        level_background = levelmap.level_back_path;
   
    levelmap.level_transition_spot = botx;

    //Starts the Player
    levelmap.playerspawnx = 32; levelmap.playerspawny = 176;
    scroll[0].camera=Player(levelmap.playerspawnx,levelmap.playerspawny);
   
    //levelmap.enemy_x[0]=EnemyX(x,y);
    levelmap.enemy_x[0].x=64;
    levelmap.enemy_x[0].y=100;
   
    start_scroll(0,0,level_graph,level_background,0,0);//starts the scroll, variables:
   
    levelmap.music_repeat = levelmap.music_repeat_true;
    levelmap.song_path=load_song("./MUSIC/LEVEL2.ogg");
        levelmap.song = levelmap.song_path;
    play_song(levelmap.song,levelmap.music_repeat);
   
    repeat
    frame;
   
    until(level_change)
    OnExit
    unload_map(file,graph);
end

Cómo puedo tener:

levelmap.level_graph_path = load_png("./LEVEL/LEVELS/a2_s1.png");
levelmap.level_mask_path = load_png("./LEVEL/LEVELS/a2_s1_mask.png");
levelmap.level_back_path = load_png("./LEVEL/BACKGROUNDS/snow_mountains_day.png");

levelmap.level_transition_spot = botx;

levelmap.playerspawnx = 32; levelmap.playerspawny = 176;
scroll[0].camera=Player(levelmap.playerspawnx,levelmap.playerspawny);

levelmap.enemy_x[0]=EnemyX(x,y);
levelmap.enemy_x[0].x=64;
levelmap.enemy_x[0].y=100;

levelmap.music_repeat = levelmap.music_repeat_true;
levelmap.song_path=load_song("./MUSIC/LEVEL2.ogg");

cargúese directamente del archivo, y no en juego.

grazie, la gente
werg

KeoH

Cuando tu usas la expresión:
variable = load_png(draw.png);


Solo almacenas el número que identifica la imagen en la memoria del PC, no la imagen. Por eso, cuando guardas los valores de las variables en una estructura, y después lo cargas, lo que obtienes son solo números que apuntan a imágenes en memoria que luego no están.


MisterN

#2
¿Qué puedo hacer tan?

EDIT:


levelmap.level_graph_path = ("./LEVEL/LEVELS/a2_s1.png");
levelmap.level_mask_path = ("./LEVEL/LEVELS/a2_s1_mask.png");
levelmap.level_back_path = ("./LEVEL/BACKGROUNDS/snow_mountains_day.png");
    level_graph = load_png(levelmap.level_graph_path);
    levelmask = load_png(levelmap.level_mask_path);
    level_background = load_png(levelmap.level_back_path);

= :D
werg