10.03.2019 - Round 1 results of our "A Love Letter For FreeBASIC" game dev competition have been published. Please be sure to check the results thread: http://games.freebasic.net/forum/index.php?topic=629.0. Don't forget that the competition is continuing with a round 2, lasting till 29th of April, 300 USD first prize. Stay tuned!

Author Topic: FBGD Rescue The Colors Competition (Nov 2011 - end of Jan 2012), 250 $ 1st prize  (Read 34883 times)

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Yeah, I've noticed your "new version" was awfully similar to the first, but I didn't want to say anything. :P
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

Lithium

  • Recruit
  • **
  • Posts: 28
    • View Profile

gothon

  • Amoeba
  • *
  • Posts: 19
    • View Profile
Ok, I have been thinking about this competition a while, and I think I have a potential entry.  I am making a simple 'snake' game (like nibbles), except it will be 3D, and in addition to gaining length when eating, you will also gain colors.  When you eat a color, you gain an ability that you will need to progress, but you will also reveal and activate colored traps and enimies.



So far I have been able to use GL_COLOR_LOGIC_OP to mask off selected color bits, however I am working on using fragment shaders to produce more controlled color transformations.

So far I only have basic movement implemented, you can download the compiled windows/linux binary from here:
http://vast3d.com/ColorEater/bin/ColorEater3D.zip

Use 'left' and 'right' to turn and 'up' to jump. 'Esc' or 'p' to pause.
« Last Edit: December 04, 2011, 04:53:10 PM by gothon »

ssjx

  • Forum Howler
  • ****
  • Posts: 174
    • View Profile
    • ssjx.co.uk
Hi,
I've updated my entry, still no name and still a little messy:

http://ssjx.co.uk/windows/fbgd.php

Currently it's 'shoot the monster things, collect the green balls they leave, revive the sleeping people'.

It's getting closer to being finished, though i think it will suffer the same problem as last year in being fun but short...

It also looks pretty primitive compared to some of the other entries being posted here...

Anyway, enjoy!

Lithium

  • Recruit
  • **
  • Posts: 28
    • View Profile
Started a thread for my entry in the Work in progress forum, link: http://games.freebasic.net/forum/index.php?topic=529.0
Maybe I should take a hint from ssjx and make a website for it.

ssjx

  • Forum Howler
  • ****
  • Posts: 174
    • View Profile
    • ssjx.co.uk
Another update (v0.1a -  http://ssjx.co.uk/windows/fbgd.php ).

Additions include:
+ Colour restored when all portals closed
+ Basic trading with key maker (ore changed to keys)
+ Locked doors and other graphics added

Main things to add include:
+ Better conversation handling with npc's
+ Npc's wandering when restored
+ More animations (notably the sleeping npc's)
+ An ending!
+ A title would be good...
+ Sounds (not expecting many points in this area...)

Ideally, i am aiming to get most of this finished next week to avoid a last minute panic at the end of January!
« Last Edit: December 17, 2011, 11:12:14 AM by ssjx »

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Sorry for disappearing guys, but work is killing me this month. I should find a lot of free time after Christmas (I took a week off) to properly test your work in progress and give feedback. Anything before that, I can't promise.

Thank you for your effort so far.
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

ChangeV

  • Amoeba
  • *
  • Posts: 15
  • spinning ChangeV
    • View Profile
    • Email
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.

Code: [Select]
#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

Lithium

  • Recruit
  • **
  • Posts: 28
    • View Profile

Teaser logo, I'll have another demo with actual gameplay in a week

gothon

  • Amoeba
  • *
  • Posts: 19
    • View Profile
Update:

I now have the snake body implemented.  I shrank the map because it was way too big, more of a color hide and seek game on that map.  At the moment, the only color that matters is yellow.  Collecting yellow will increase your ability to jump, but it will also increase the height of the sand blocks.  Hitting any wall 2 blocks high or higher will kill you and reset the game, (though not your collected colors).  Play as long as you like, there is no ending or second level yet, and color food will keep spawning even after you have maxed them.

I now have color transformations working in hardware and in software for older opengl/video cards, although the software method is both slower and messier, so hopefully most players will have hardware support.

Next I plan to implement a tongue based ability, and some monsters/blocks you can eat using the tongue.

http://vast3d.com/ColorEater/bin/ColorEater3D-2.zip (Windows binarys)
http://vast3d.com/ColorEater/bin/ColorEater3D-2-OSX.zip (MacOSX binarys)

« Last Edit: December 28, 2011, 11:21:08 PM by gothon »

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
Love your effort so far guys. Really nice.

ssjx, I can see now where you main concept is going toward. Very exploitable idea. Hope you will have time to polish up the engine and create more vibrant and stimulating graphics.

cool engine, gothon. Plays really smooth. Very interested to see how this can be turned into a challenging game.

Relativity. Looking great so far Lithium. Most potential WIP released so far. As with others, I hope you can nail it down into a fun and coherent game before the deadline. Or even later. Would hate to see this engine ending up on that.

ChangeV. Great to see you here! As with ssjx, your idea is very exploitable. I'm sure this can develop into an excellent entry when JawsV great gfx comes into play.

Thank you guys! Looking forward to new demos/news. :) Cca 40 days to go!
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

ssjx

  • Forum Howler
  • ****
  • Posts: 174
    • View Profile
    • ssjx.co.uk
@Gothon,

Hi, just tried your demo, it's brilliant and incredibly addictive! Hopefully you wiill make some other levels to bounce around in!

Btw, it uses the software rendering for me which works fine!
 

ssjx

  • Forum Howler
  • ****
  • Posts: 174
    • View Profile
    • ssjx.co.uk
Another update, changes include:

* Speech bubbles!
* A story intro, title screen, completion screen
* NPC's now wander when revived.
* Score (though not saved yet)
* Some sounds (2!)
* Various bugs and problems removed/added...
* It has a title of 'Invasion of the Mononites' but this is subject to change.

http://ssjx.co.uk/windows/fbgd.php

Besides some further polish, i don't imagine too many more changes between this and the final version. One of main aims was to make sure the game is solid and has a nice start/end.

That being said:

* I do have an idea for a lemmings style bonus game where you have to guide dazed revived people to a portal by shifting blocks...

* I am trying to think of a way to include fire in the game!

Anyway, still a month to think of something to pad the game out with!

Lachie Dazdarian

  • Double dipper
  • Administrator
  • Forum Sage
  • *****
  • Posts: 1308
    • Yahoo Instant Messenger - lachie13
    • View Profile
    • The Maker Of Stuff
    • Email
You can always try to polish up the engine. I mean, maybe add Mario-like movement with inertia. Also, I think the projectile speed should be slightly higher than player's, so I wouldn't be able to run with it.

Beside that, you can always add some creative commons track playing in the background, better title screen, main menu, custom fonts (use my routines!), more details!

Anyway, I guess it all breaks down to inspiration...

Plays ok so far. Will find time later next week to give it a proper test.
"Things like Basic and Free Basic provide much-needed therapy and a return to sanity and a correct appreciation of people. The arrogant folk really hate a word like 'Basic' - fine, and good riddance." ~ pragmatist

ssjx

  • Forum Howler
  • ****
  • Posts: 174
    • View Profile
    • ssjx.co.uk
A lot of that is on the to do list, i was mainly concerned with making sure i had a title screen/intro/outro etc! I like the idea of the current title screen for example, but i aim to replace it with a smooth equivalent and not the 'jumpier' current version.

I hadn't thought of player inertia...

Also high on the todo list is remembering to change the player sprite to a mono version!

Having some form of  indicator of what can be revived would also be useful! :)