sBeamExpl
0
-1
0
0
<undefined>
<undefined>
1
603
7
0
0
-1
2
self
0
0
1
//global.clear = 0; ??????
visible = 0; // hide me!
// initially triallogic will merely act as a spawn point but does more than that
alarm[0] = 1; // alarm for spawning samus
// variables
timer_started = 0;
timer = 0; // in tics
// GENERATING THE LEVEL
// grid for making visuals later
var grid = ds_grid_create(200,150);
// open the file yoinked from global.level_is
var file = file_text_open_read("stages/"+global.level_is);
// skip the strings, they aren't important
repeat (3){
file_text_readln(file);
}
// get a var from the last one
var fr = file_text_read_string(file);
if (fr == ""){
var hdn = 1;
}else{
var hdn = real(fr);
}
file_text_readln(file);
// objs
while (!file_text_eof(file)){
var xx = file_text_read_real(file);
file_text_readln(file);
var yy = file_text_read_real(file);
file_text_readln(file);
var ty = file_text_read_real(file);
file_text_readln(file);
switch (ty){
case 0: // normal solid
instance_create(xx,yy,oSolid1);
ds_grid_set(grid,floor(xx/16),floor(yy/16),1);
break;
case 1: // slope 1
instance_create(xx,yy,oSlope1);
ds_grid_set(grid,floor(xx/16),floor(yy/16),2);
break;
case 2: // slope 2
instance_create(xx,yy,oSlope2);
ds_grid_set(grid,floor(xx/16),floor(yy/16),3);
break;
case 3: // crack block
instance_create(xx,yy,oBlockStep);
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 4: // beamblock
instance_create(xx,yy,oBlockShoot);
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 5: // bombblock
instance_create(xx,yy,oBlockBomb);
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 6: // missileblock
with (instance_create(xx,yy,oBlockMissile)){
regentime = -1;
}
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 7: // superblock
with (instance_create(xx,yy,oBlockSMissile)){
regentime = -1;
}
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 8: // pbombblock
with (instance_create(xx,yy,oBlockPBomb)){
regentime = -1;
}
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 9: // screwblock
instance_create(xx,yy,oBlockScrew);
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 10: // speedblock
instance_create(xx,yy,oBlockSpeed);
ds_grid_set(grid,floor(xx/16),floor(yy/16),4);
break;
case 11: // spawn. also for filling grid
x = xx+8;
y = yy+16;
var s_x = x;
var s_y = y-8;
break;
case 12: // FREEDOM
instance_create(xx,yy,oTrialGoal);
break;
case 13: // spikes
instance_create(xx,yy,oSpikes4);
ds_grid_set(grid,floor(xx/16),floor(yy/16),5);
break;
// items
case 14: // spiderball
instance_create(xx,yy+16,oTTSpider);
break;
case 15: // jumpball
instance_create(xx,yy+16,oTTSpring);
break;
case 16: // hijump
instance_create(xx,yy+16,oTTHijump);
break;
case 17: // spacejump
instance_create(xx,yy+16,oTTSpace);
break;
case 18: // bombs
instance_create(xx,yy+16,oTTBomb);
break;
case 19: // missile
instance_create(xx,yy+16,oTTMissile);
break;
case 20: // super
instance_create(xx,yy+16,oTTSuper);
break;
case 21: // power
instance_create(xx,yy+16,oTTPower);
break;
case 22: // screw
instance_create(xx,yy+16,oTTScrew);
break;
case 23: // speed
instance_create(xx,yy+16,oTTBooster);
break;
}
}
// now make visuals off of the grid
for (var i = 0; i < 200; ++i;){
for (var v = 0; v < 150; ++v;){
switch (ds_grid_get(grid,i,v)){
case 1:
tile_add(tlTimeTrial,0,0,16,16,i*16,v*16,-100);
break;
case 2:
tile_add(tlTimeTrial,32,0,16,16,i*16,v*16,-100);
break;
case 3:
tile_add(tlTimeTrial,48,0,16,16,i*16,v*16,-100);
break;
case 4:
if (hdn){ // only make block sprites if hdn isn't false
tile_add(tlTimeTrial,16,0,16,16,i*16,v*16,-122);
}
break;
case 5: // spikes
var place = 0;
// messy code.. but it works
if (ds_grid_get(grid,i,v-1) == 1){
place = 2; // place on ceiling
}
if (ds_grid_get(grid,i,v+1) == 1){
place = 1; // place on floor
}
if (ds_grid_get(grid,i+1,v) != 5 && ds_grid_get(grid,i-1,v) != 5){
// don't perform wall checks if there are spikes on the sides, otherwise..
if (ds_grid_get(grid,i-1,v) == 1){
place = 3; // place on left wall
}
if (ds_grid_get(grid,i+1,v) == 1){
place = 4; // place on right wall
}
}
switch (place){
case 2:
tile_add(tlTimeTrial,32,16,16,16,i*16,v*16,-122);
break;
case 3:
tile_add(tlTimeTrial,16,16,16,16,i*16,v*16,-122);
break;
case 4:
tile_add(tlTimeTrial,48,16,16,16,i*16,v*16,-122);
break;
default:
tile_add(tlTimeTrial,0,16,16,16,i*16,v*16,-122);
break;
}
break;
}
}
}
// kill the grid because memory leaks are bad
ds_grid_destroy(grid);
// and kill the file because i didn't do that apparently..?
file_text_close(file);
1
603
7
0
0
-1
2
self
0
0
1
goal_trial();
1
603
7
0
0
-1
2
self
0
0
1
oCharacter.x = x;
oCharacter.y = y;
1
603
7
0
0
-1
2
self
0
0
1
if (timer_started == 1){
timer += 1;
}
if (timer_started == 0) && !(oCharacter.state == 33){
mus_stop_all();
mus_loop(musTrialsPlay);
timer_started = 1;
}
/* this was debug code for screenshots
if (keyboard_check(vk_alt)){
room_speed = 6;
}else{
room_speed = 60;
}
*/
// slow down time before transitioning to the next screen once the course is complete
if (timer_started == -1){
room_speed -= 1;
if (room_speed < 15){
room_speed = 60;
goal_trial();
}
}
0
0
0
0.5
0.100000001490116
0
0.100000001490116
0.100000001490116
0.200000002980232
-1
0