I've been too busy lately, I haven't touched project for 3 weeks.
here is basic idea concept and sample program which tests the colored-switch idea.
#IFNDEF TRUE
CONST FALSE = 0
CONST TRUE = NOT FALSE
#ENDIF
#INCLUDE ONCE "fbgfx.bi"
USING fb
ENUM blahblah
result_nothing = 0
result_stage_cleared
result_user_quit
result_game_over
result_ok
END ENUM
TYPE enemy_type
x AS INTEGER
y AS INTEGER
respawn_x AS INTEGER
respawn_y AS INTEGER
direction AS INTEGER
speed AS INTEGER
move_range AS INTEGER
base_color AS INTEGER
END TYPE
TYPE player_type
is_dead AS INTEGER
x AS INTEGER
y AS INTEGER
dx AS INTEGER
dy AS INTEGER
respawn_x AS INTEGER
respawn_y AS INTEGER
END TYPE
CONST AS INTEGER white1 = 15, white2 = 248
CONST AS INTEGER blue = 249, light_blue = 250
CONST AS INTEGER red = 251, light_red = 252
DIM AS INTEGER game_result
DIM SHARED AS STRING * 20 mapdata(0 TO 29) => {_
"11111111111111111111",_
"15000011111311111111",_
"10111033333333330001",_
"10111011111111110701",_
"10000011111111110001",_
"11111222111111111111",_
"11111110000000000001",_
"11111110111111110001",_
"11111110111111110401",_
"11111110111111110001",_
"11111110111111110001",_
"11100000000011111111",_
"11106000000011111111",_
"11100000000011111111",_
"11111111111111111111",_ '
_
"11111111111111111111",_
"10000011111111111111",_
"10000011111111111111",_
"10600000004088881111",_
"10000011111111181111",_
"11111111111111181111",_
"10000111111111181111",_
"10000111111111101111",_
"10700000111115001111",_
"10000110111111101111",_
"10000110111111101111",_
"11111110111111101111",_
"11119999999999999991",_
"11111111111111111111",_
"11111111111111111111"}
DIM SHARED AS INTEGER map(20, 15)
DIM SHARED AS INTEGER switch(10)
DIM SHARED AS INTEGER player_is_dead
DIM SHARED AS player_type player
DIM SHARED AS enemy_type enemy(10)
DECLARE SUB PRINT_ (s AS STRING)
DECLARE SUB DELAY (BYVAL n AS DOUBLE)
DECLARE SUB CLEANUP DESTRUCTOR
DECLARE SUB INITIALIZE_COLOR ()
DECLARE SUB INITIALIZE_MAP (BYVAL stage AS INTEGER = 1)
DECLARE SUB INITIALIZE_ENEMY (BYVAL stage AS INTEGER = 1)
DECLARE SUB INITIALIZE_PLAYER(BYVAL stage AS INTEGER = 1)
DECLARE SUB PROCESS_ENEMY (BYVAL stage AS INTEGER = 1)
DECLARE SUB PROCESS_PLAYER (BYVAL stage AS INTEGER = 1)
DECLARE SUB PROCESS_SWITCH (BYVAL stage AS INTEGER = 1)
DECLARE FUNCTION CHECK_FOR_GOAL (BYVAL stage AS INTEGER = 1) AS INTEGER
DECLARE SUB DRAW_MAP (BYVAL stage AS INTEGER = 1)
DECLARE SUB DRAW_PLAYER (BYVAL x AS INTEGER, BYVAL y AS INTEGER, color_base AS INTEGER = 31)
DECLARE SUB DRAW_ENEMY (BYVAL x AS INTEGER, BYVAL y AS INTEGER, BYVAL c AS INTEGER = white2)
'map grid checking.
DECLARE FUNCTION CHECK_FOR_SOLID_CELL (BYVAL i AS INTEGER, BYVAL j AS INTEGER) AS INTEGER
DECLARE FUNCTION CHECK_RECTANGLE (BYVAL xx AS INTEGER, BYVAL yy AS INTEGER) AS INTEGER
DECLARE SUB title( BYREF result AS INTEGER)
DECLARE SUB stage_clear_message()
DECLARE SUB GAME_OVER_MESSAGE()
DECLARE SUB TO_BE_CONTINUED_MESSAGE()
DECLARE SUB PLAY_STAGE (BYVAL stage AS INTEGER, BYREF result AS INTEGER)
SUB PRINT_ (s AS STRING)
DIM AS INTEGER DEBUG = FREEFILE
OPEN CONS FOR OUTPUT AS #debug 'debug message log
? #debug, s
CLOSE #debug
END SUB
SUB DELAY(n AS DOUBLE)
DIM AS DOUBLE old_timer = TIMER
DO
SLEEP 1, 1
LOOP UNTIL (old_timer + n) <= TIMER
END SUB
SUB CLEANUP DESTRUCTOR
'this will reduce some typing. I'm lazy.
#DEFINE remove(blahblah) IF ( blahblah ) <> 0 THEN IMAGEDESTROY( blahblah )
'PRINT "-Clean up. freeing some images"
'remove ( some_tile )
END SUB
SUB INITIALIZE_COLOR()
'change unused palette 248-255 into some colors
PALETTE white2 , 255, 255, 255
PALETTE blue , 0, 0, 255
PALETTE light_blue , 0, 0, 96
PALETTE red , 255, 0, 0
PALETTE light_red , 96, 0, 0
END SUB
SUB INITIALIZE_MAP(BYVAL stage AS INTEGER = 1)
'initialize map
FOR j AS INTEGER =0 TO 14
FOR i AS INTEGER =0 TO 19
SELECT CASE AS CONST stage
CASE 1 'load stage 1 data into map
map(i, j) = VAL(MID(mapdata(j), i + 1, 1))
CASE 2 'load stage 2 data into map
map(i, j) = VAL(MID(mapdata(j + 15), i + 1, 1))
END SELECT
NEXT
NEXT
FOR i AS INTEGER = 0 TO 9
switch(i) = FALSE
NEXT
END SUB
SUB INITIALIZE_ENEMY(BYVAL stage AS INTEGER = 1)
SELECT CASE AS CONST stage
CASE 1
'initialize enemy
enemy(0).x = 32*11+15
enemy(0).y = 32*2+15
enemy(0).respawn_x = enemy(0).x
enemy(0).respawn_y = enemy(0).y
enemy(0).direction = 1
enemy(0).speed = 1
enemy(0).move_range = 64
enemy(0).base_color = white2
CASE 2
enemy(0).x = 32*15+15
enemy(0).y = 32*3+15
enemy(0).respawn_x = enemy(0).x
enemy(0).respawn_y = enemy(0).y
enemy(0).direction = 4
enemy(0).speed = 1
enemy(0).move_range = 64+32
enemy(0).base_color = red
enemy(1).x = 32*8+15
enemy(1).y = 32*12+15
enemy(1).respawn_x = enemy(1).x
enemy(1).respawn_y = enemy(1).y
enemy(1).direction = 1
enemy(1).speed = 1
enemy(1).move_range = 64+32+32
enemy(1).base_color = red
enemy(2).x = 32*10+15
enemy(2).y = 32*12+15
enemy(2).respawn_x = enemy(2).x
enemy(2).respawn_y = enemy(2).y
enemy(2).direction = 1
enemy(2).speed = 1
enemy(2).move_range = 64+32+32
enemy(2).base_color = blue
enemy(3).x = 32*12+15
enemy(3).y = 32*12+15
enemy(3).respawn_x = enemy(3).x
enemy(3).respawn_y = enemy(3).y
enemy(3).direction = 1
enemy(3).speed = 1
enemy(3).move_range = 64+32+32
enemy(3).base_color = blue
enemy(4).x = 32*14+15
enemy(4).y = 32*12+15
enemy(4).respawn_x = enemy(4).x
enemy(4).respawn_y = enemy(4).y
enemy(4).direction = 1
enemy(4).speed = 1
enemy(4).move_range = 64+32+32
enemy(4).base_color = red
END SELECT
END SUB
SUB INITIALIZE_PLAYER(BYVAL stage AS INTEGER = 1)
SELECT CASE AS CONST stage
CASE 1 'initialize player for stage 1
player.x = 32*4+15
player.y = 32*12+15
CASE 2 'initialize player for stage 2
player.x = 32*2+15
player.y = 32*3+15
END SELECT
player.dx = 0
player.dy = 0
player.is_dead = FALSE
END SUB
SUB PROCESS_SWITCH(BYVAL stage AS INTEGER = 1)
'check if player hits switch
SELECT CASE AS CONST stage
CASE 1 'stage 1 switch processing
'firse switch
IF SQR(( (17*32+16)-(player.x) )^2 + ((8*32+16)-(player.y))^2) <= 20 THEN
switch(0) = TRUE
END IF
'second switch
IF SQR(( (1*32+16)-(player.x) )^2 + ((1*32+16)-(player.y))^2) <= 20 THEN
switch(0) = FALSE
END IF
CASE 2 'stage 2 switch processing
'red switch
IF SQR(( (10*32+16)-(player.x) )^2 + ((3*32+16)-(player.y))^2) <= 20 THEN
switch(0) = TRUE
END IF
'blue switch
IF SQR(( (13*32+16)-(player.x) )^2 + ((8*32+16)-(player.y))^2) <= 20 THEN
switch(1) = TRUE
END IF
END SELECT
END SUB
SUB PROCESS_ENEMY(BYVAL stage AS INTEGER = 1)
#DEFINE radius 10
'--- enemy section ------------
SELECT CASE AS CONST stage
CASE 1 'stage 1 enemy stuff (hard coded)
'check if enemy moved too far from origin, flip its direction
IF ABS(enemy(0).respawn_x - enemy(0).x) > enemy(0).move_range THEN
enemy(0).direction *= -1
END IF
'move enemy
enemy(0).x += enemy(0).speed * enemy(0).direction
'--------------------hit detection needed
IF POINT(enemy(0).x+7, enemy(0).y) <> 15 THEN
IF (player.x >= enemy(0).x-13) AND (player.x<= enemy(0).x+13) AND _
(player.y >= enemy(0).y-12-radius) AND (player.y <= enemy(0).y+13+radius) THEN player.is_dead or= TRUE
IF (player.x >= enemy(0).x-13-radius) AND (player.x<= enemy(0).x+13+radius ) AND _
(player.y >= enemy(0).y-12) AND (player.y <= enemy(0).y+13 ) THEN player.is_dead or= TRUE
player.is_dead or= SQR((( enemy(0).x-13)-player.x )^2 + (((enemy(0).y-12) - player.y))^2) <= radius
player.is_dead or= SQR((( enemy(0).x+13)-player.x )^2 + (((enemy(0).y-12) - player.y))^2) <= radius
player.is_dead or= SQR((( enemy(0).x-13)-player.x )^2 + (((enemy(0).y+13) - player.y))^2) <= radius
player.is_dead or= SQR((( enemy(0).x+13)-player.x )^2 + (((enemy(0).y+13) - player.y))^2) <= radius
END IF
CASE 2
IF (enemy(0).direction=4) AND (ABS(enemy(0).respawn_x - enemy(0).x) > enemy(0).move_range) THEN enemy(0).direction = 2
IF (enemy(0).direction=2) AND (enemy(0).respawn_x = enemy(0).x-1) THEN enemy(0).direction = 3
IF (enemy(0).direction=3) AND (ABS(enemy(0).respawn_y - enemy(0).y) > enemy(0).move_range) THEN enemy(0).direction = 1
IF (enemy(0).direction=1) AND (enemy(0).respawn_y = enemy(0).y) THEN enemy(0).direction = 4
SELECT CASE AS CONST enemy(0).direction
CASE 1 : enemy(0).y -= enemy(0).speed
CASE 2 : enemy(0).x += enemy(0).speed
CASE 3 : enemy(0).y += enemy(0).speed
CASE 4 : enemy(0).x -= enemy(0).speed
END SELECT
FOR i AS INTEGER = 1 TO 4
'check if enemy moved too far from origin, flip its direction
IF ABS(enemy(i).respawn_x - enemy(i).x) > enemy(i).move_range THEN
enemy(i).direction *= -1
END IF
'move enemy
enemy(i).x += enemy(i).speed * enemy(i).direction
NEXT
'let's check hit detection for all enemies here
'if any of them touches player, dead flag will be set.
FOR i AS INTEGER = 0 TO 4
'enemy hidden under the colored panel can't touch player.
'use point to pick up panel color and compare with enemy color.
IF POINT(enemy(i).x+7, enemy(i).y) <> enemy(i).base_color THEN
IF (player.x >= enemy(i).x-13) AND (player.x<= enemy(i).x+13) AND _
(player.y >= enemy(i).y-12-radius) AND (player.y <= enemy(i).y+13+radius) THEN player.is_dead or= TRUE
IF (player.x >= enemy(i).x-13-radius) AND (player.x<= enemy(i).x+13+radius ) AND _
(player.y >= enemy(i).y-12) AND (player.y <= enemy(i).y+13 ) THEN player.is_dead or= TRUE
player.is_dead or= SQR((( enemy(i).x-13)-player.x )^2 + (((enemy(i).y-12) - player.y))^2) <= radius
player.is_dead or= SQR((( enemy(i).x+13)-player.x )^2 + (((enemy(i).y-12) - player.y))^2) <= radius
player.is_dead or= SQR((( enemy(i).x-13)-player.x )^2 + (((enemy(i).y+13) - player.y))^2) <= radius
player.is_dead or= SQR((( enemy(i).x+13)-player.x )^2 + (((enemy(i).y+13) - player.y))^2) <= radius
END IF
NEXT
END SELECT
END SUB
SUB PROCESS_PLAYER(BYVAL stage AS INTEGER = 1)
'check if player tries to go into walls using too big dx, dy
'adjust dx or dy until player stands right next to wall
IF player.dy > 0 AND CHECK_RECTANGLE(player.x, player.y + player.dy) THEN
DO
player.dy -= 1
LOOP UNTIL CHECK_RECTANGLE(player.x, player.y + player.dy) = FALSE OR player.dy < -1000
END IF
IF player.dy < 0 AND CHECK_RECTANGLE(player.x, player.y + player.dy) THEN
DO
player.dy += 1
LOOP UNTIL CHECK_RECTANGLE(player.x, player.y + player.dy) = FALSE OR player.dy > 1000
END IF
IF player.dx > 0 AND CHECK_RECTANGLE(player.x + player.dx, player.y) THEN
DO
player.dx -= 1
LOOP UNTIL CHECK_RECTANGLE(player.x+ player.dx, player.y ) = FALSE OR player.dx < -1000
END IF
IF player.dx < 0 AND CHECK_RECTANGLE(player.x+ player.dx, player.y ) THEN
DO
player.dx += 1
LOOP UNTIL CHECK_RECTANGLE(player.x+ player.dx, player.y ) = FALSE OR player.dx > 1000
END IF
'dx, dy seems ok. use them to update player's position
player.x += player.dx
player.dx = 0
player.y += player.dy
player.dy = 0
END SUB
FUNCTION CHECK_FOR_GOAL (BYVAL stage AS INTEGER = 1) AS INTEGER
'exit area position is hardcoded
SELECT CASE AS CONST stage
CASE 1
IF SQR(( (17*32+16)-(player.x) )^2 + ((3*32+16)-(player.y))^2) <= 20 THEN
RETURN TRUE
END IF
CASE 2
IF SQR(( (2*32+16)-(player.x) )^2 + ((8*32+16)-(player.y))^2) <= 20 THEN
RETURN TRUE
END IF
END SELECT
RETURN FALSE
END function
SUB DRAW_MAP(BYVAL stage AS INTEGER = 1)
LINE(0,0)-(639,479), 0,bf
FOR j AS INTEGER =0 TO 14
FOR i AS INTEGER =0 TO 19
SELECT CASE map(i, j)
CASE 0 'empty road
LINE(i*32,j*32)-(i*32+31, j*32+31),0,bf
CASE 1 'solid wall
LINE(i*32,j*32)-(i*32+31, j*32+31),15,bf
CASE 2 'wall block 1 (depending on switch state)
IF switch(0) THEN
LINE(i*32,j*32)-(i*32+31, j*32+31),0,bf
ELSE
LINE(i*32,j*32)-(i*32+31, j*32+31),15,bf
END IF
CASE 3 'wall block 1
IF switch(0) THEN
LINE(i*32,j*32)-(i*32+31, j*32+31),15,bf
ELSE
LINE(i*32,j*32)-(i*32+31, j*32+31),0,bf
END IF
CASE 4 'switch 1
SELECT CASE AS CONST stage
CASE 1 'stage 1 switch
CIRCLE(i*32+16,j*32+16),10 ,(white1)
IF switch(0) THEN CIRCLE(i*32+16,j*32+16),8 ,(white1),,,,f
CASE 2 'stage 2 red switch
CIRCLE(i*32+16,j*32+16),10 ,(red)
IF switch(0) THEN CIRCLE(i*32+16,j*32+16),8 ,(red),,,,f
END SELECT
CASE 5 'switch 2
SELECT CASE AS CONST stage
CASE 1 'stage 1 switch2
CIRCLE(i*32+16,j*32+16),10 , (white1)
IF NOT(switch(0)) THEN CIRCLE(i*32+16,j*32+16),8 ,(white1),,,,f
CASE 2 'stage 2 blue switch
CIRCLE(i*32+16,j*32+16),10 , (blue)
IF switch(1) THEN CIRCLE(i*32+16,j*32+16),8 ,(blue),,,,f
END SELECT
CASE 6 'start
PSET(i*32+16,j*32+16)
DRAW "c15ne10nf10ng10nh10"
CASE 7 'goal
CIRCLE(i*32+16,j*32+16+5),3 ,(15),,,.6
CIRCLE STEP(0,0),7 ,(15),,,.6
LINE -STEP(0,-20),(15)
DRAW "c 15 M+10,+5M-10,+5bm+5,-5p 15, 15"
CASE 8 'red panel
IF switch(0) THEN
LINE(i*32,j*32)-(i*32+31, j*32+31),red,bf
ELSE
LINE(i*32,j*32)-(i*32+31, j*32+31),light_red,bf
END IF
CASE 9 'blue panel
IF switch(1) THEN
LINE(i*32,j*32)-(i*32+31, j*32+31),blue,bf
ELSE
LINE(i*32,j*32)-(i*32+31, j*32+31),light_blue,bf
END IF
END SELECT
NEXT
NEXT
END SUB
SUB DRAW_PLAYER(BYVAL x AS INTEGER, y AS INTEGER, color_base AS INTEGER = 31)
CIRCLE(x , y), 10, color_base
CIRCLE(x-3, y), 4, color_base, , , 1.5
CIRCLE(x+4, y), 4, color_base, , , 1.5
PAINT (x, y+3), color_base, color_base
END SUB
SUB DRAW_ENEMY(BYVAL x AS INTEGER, BYVAL y AS INTEGER, BYVAL c AS INTEGER = white2)
LINE (x - 13, y - 12)-(x + 13, y + 13), c, b
PSET (x - 3, y + 7), c
DRAW "c" & c & "h7u5f7d5"
PSET (x + 3, y + 7), c
DRAW "c" & c & "e7u5g7d5"
PAINT (x, y), c, c
END SUB
SUB DRAW_ENEMIES(BYVAL stage AS INTEGER = 1)
SELECT CASE AS CONST stage
CASE 1
DRAW_ENEMY(enemy(0).x, enemy(0).y, enemy(0).base_color)
CASE 2
DRAW_ENEMY(enemy(0).x, enemy(0).y, enemy(0).base_color)
DRAW_ENEMY(enemy(1).x, enemy(1).y, enemy(1).base_color)
DRAW_ENEMY(enemy(2).x, enemy(2).y, enemy(2).base_color)
DRAW_ENEMY(enemy(3).x, enemy(3).y, enemy(3).base_color)
DRAW_ENEMY(enemy(4).x, enemy(4).y, enemy(4).base_color)
END SELECT
END SUB
FUNCTION CHECK_FOR_SOLID_CELL(i AS INTEGER, j AS INTEGER) AS INTEGER
'if try to access out of array range, return true
IF (i >= 0) AND (i <= 19) AND (j >= 0) AND (j <= 14) THEN
' condition for detectint wall needed
SELECT CASE map(i, j)
CASE 0,4,5,6,7,8,9 'empty, start, end, switchs, colored walls
RETURN FALSE
CASE 1 'normal wall
RETURN TRUE
CASE 2 'special wall
IF switch(0) THEN RETURN FALSE ELSE RETURN TRUE
CASE 3 'special wall
IF switch(0) THEN RETURN TRUE ELSE RETURN FALSE
CASE ELSE 'every other walls just in case
RETURN TRUE
END SELECT
ELSE
RETURN TRUE 'out of map grid range(20,15)
END IF
END FUNCTION
FUNCTION CHECK_RECTANGLE(xx AS INTEGER, yy AS INTEGER) AS INTEGER
DIM AS INTEGER gxl, gxr, gyu, gyd
'check solid or not with on_the_map position
gxl = (xx - 10) \ 32
gxr = (xx + 10) \ 32
gyu = (yy - 10) \ 32
gyd = (yy + 10) \ 32
DIM mul AS INTEGER
DIM mur AS INTEGER
DIM mdl AS INTEGER
DIM mdr AS INTEGER
mul = CHECK_FOR_SOLID_CELL(gxl, gyu)
mur = CHECK_FOR_SOLID_CELL(gxr, gyu)
mdl = CHECK_FOR_SOLID_CELL(gxl, gyd)
mdr = CHECK_FOR_SOLID_CELL(gxr, gyd)
RETURN (mul OR mur OR mdl OR mdr)
END FUNCTION
SUB title( BYREF result AS INTEGER)
DIM k AS string
CLS
LOCATE 15,27
PRINT " temporary title screen "
LOCATE 45,27
PRINT "press [space key] to start"
DO
k=INKEY
SLEEP 1,1
LOOP until k=" " OR k = CHR(27)
IF k = " " THEN
result = result_ok
ELSE
result = result_user_quit
END IF
END SUB
SUB stage_clear_message()
LOCATE 28, 29: PRINT " "
LOCATE 29, 29: PRINT " "
LOCATE 30, 29: PRINT " S T A G E C L E A R "
LOCATE 31, 29: PRINT " "
LOCATE 32, 29: PRINT " "
SLEEP 2000,1
CLS
SLEEP 500,1
WHILE LEN(INKEY)
WEND
END SUB
SUB game_over_message()
LOCATE 28, 31: PRINT " "
LOCATE 29, 31: PRINT " "
LOCATE 30, 31: PRINT " G A M E O V E R "
LOCATE 31, 31: PRINT " "
LOCATE 32, 31: PRINT " "
SLEEP 2000,1
CLS
SLEEP 500,1
WHILE LEN(INKEY)
WEND
END SUB
SUB to_be_continued_message ()
cls
LOCATE 28, 31: PRINT " "
LOCATE 29, 31: PRINT " "
LOCATE 30, 31: PRINT " to be continued "
LOCATE 31, 31: PRINT " "
LOCATE 32, 31: PRINT " "
SLEEP 3000,1
WHILE LEN(INKEY)
WEND
END SUB
SUB PLAY_STAGE(BYVAL stage AS INTEGER, BYREF result AS INTEGER)
DIM AS INTEGER quit_game = FALSE, player_dead = FALSE, stage_clear = FALSE
DIM AS STRING k
result = result_nothing
IF stage < 3 THEN
INITIALIZE_MAP(stage)
INITIALIZE_ENEMY(stage)
INITIALIZE_PLAYER(stage)
DO
k = INKEY
quit_game = (k = CHR(27))
'if URDL direction key is pressed, set just dx and dy here.
IF MULTIKEY(SC_UP) THEN player.dy = -2
IF MULTIKEY(SC_DOWN) THEN player.dy = +2
IF MULTIKEY(SC_LEFT) THEN player.dx = -2
IF MULTIKEY(SC_RIGHT) THEN player.dx = +2
SCREENLOCK
DRAW_MAP(stage)
PROCESS_ENEMY(stage)
PROCESS_PLAYER(stage)
PROCESS_SWITCH(stage)
stage_clear = CHECK_FOR_GOAL(stage)
'--- output section ------------
DRAW_ENEMIES(stage)
DRAW_PLAYER(player.x, player.y,31)
'player.is_dead = FALSE
SCREENUNLOCK
'some simple delay
DELAY .011
IF MULTIKEY(SC_LSHIFT) THEN DELAY(.5)
LOOP UNTIL quit_game OR player.is_dead OR stage_clear
'game loop has ended with various reasons.
'if reason is stage clear, set the result flag.
IF stage_clear THEN
result = result_stage_cleared
stage_clear_message()
END IF
'if player is dead, display game over screen for a few seconds.
IF player.is_dead THEN GAME_OVER_MESSAGE()
'if esv key is pressed, return to title screen with quit flag seting
IF quit_game THEN result = result_user_quit
ELSE
'there is no stage 3.
'display be continued message or something.
TO_BE_CONTINUED_MESSAGE()
result = result_game_over 'treat as gameover and go back to title screen
END IF
END SUB
'--- main ---
RANDOMIZE TIMER
SCREENRES 640, 480, 8,, GFX_HIGH_PRIORITY
SETMOUSE ,,0
INITIALIZE_COLOR() 'make some unused color into white, red, blue.. etc.
DO
TITLE(game_result)
IF game_result = result_ok THEN
'repeat stage-1 until stage-clear or quit
DO
PLAY_STAGE(1, game_result)
LOOP UNTIL game_result = result_user_quit OR game_result = result_stage_cleared
'go to next stage on stage-1-clear
IF game_result = result_stage_cleared THEN
'repeat stage-2 until stage-clear or quit
DO
PLAY_STAGE(2, game_result)
LOOP UNTIL game_result = result_user_quit OR game_result = result_stage_cleared
'display "to be continued" mesage on stage-2-clear
IF game_result = result_stage_cleared THEN
PLAY_STAGE (3, game_result)
END IF
END IF
END IF
LOOP UNTIL game_result = result_user_quit
it's simple stage based maze game where player avoids enemy and get to the goal.
black and white only in the beginning.
get color gem to unlock color switchs.
each color switch will light up some area. and enemy with same color will be invisible (can pass through)
certain area will be affected by more than 1 switch.
combined color will be need to pass certain enemies(red, orange, yellow, green, blue, purple, and some weird color for all 3 color switches)
at first, stage will be 1 screen.
later, bigger stage will be scrolled. (and maybe add minimap.)
additional idea
maybe, later stage will require color key to open the door.
even more colors using 32bit-color wheel.
paint bucket: player changes color and sneak into background.
pulsating/color changing area, focus on timing to pass enemy.
other hazards idea :
conveyor belt
pushable block
switch with timer
warp panel
saw follows the wall
various traps on floor
ice floor(sliding until hit wall)
traps that shoot projectiles
one way door