ExciteMike.com - Games by Mike Meyer ExciteMike.com - Games by Mike Meyer

I Made a Towlr at GDC

Play it HERE.

!!!TICKYTACKY!!!I Made a Towlr at GDC!!!TICKYTACKY!!! --%20I%20like%20to%20constant%20constant%0DBG_CHANGE_DELAY%20%3D%201.4%0DHUES%20%3D%20%7B%209/60%2C%203/6%2C%205/6%20%7D%0DNUM_HUES%20%3D%203%0DPLAYER_SIZE%20%3D%204%0DPLAYER_SPEED%20%3D%2050%0D%0DWALL_TYPE_YELLOW%20%20%3D%200%0DWALL_TYPE_CYAN%20%20%20%20%3D%201%0DWALL_TYPE_MAGENTA%20%3D%202%0DWALL_TYPE_BLACK%20%20%20%3D%203%0Dcurrent_safe_wall%20%3D%200%0D%0Dwalls%20%3D%20%7B%20%7Bx%3D0%2C%20%20%20%20y%3D-98%2C%20w%3D300%2C%20h%3D%20%204%2C%20t%3DWALL_TYPE_BLACK%7D%2C%0D%09%09%20%20%7Bx%3D-148%2C%20y%3D%20%200%2C%20w%3D%20%204%2C%20h%3D200%2C%20t%3DWALL_TYPE_BLACK%7D%2C%0D%09%09%20%20%7Bx%3D%20148%2C%20y%3D%20%200%2C%20w%3D%20%204%2C%20h%3D200%2C%20t%3DWALL_TYPE_BLACK%7D%2C%0D%09%09%20%20%7Bx%3D%20-81%2C%20y%3D%2098%2C%20w%3D142%2C%20h%3D%20%204%2C%20t%3DWALL_TYPE_BLACK%7D%2C%0D%09%09%20%20%7Bx%3D%20%2081%2C%20y%3D%2098%2C%20w%3D142%2C%20h%3D%20%204%2C%20t%3DWALL_TYPE_BLACK%7D%2C%0D%09%09%20%20%0D%09%09%20%20%7Bx%3D%20-50%2C%20y%3D70%2C%20w%3D8%2C%20h%3D48%2C%20t%3DWALL_TYPE_BLACK%7D%2C%0D%09%09%20%20%7Bx%3D%20%2050%2C%20y%3D70%2C%20w%3D8%2C%20h%3D48%2C%20t%3DWALL_TYPE_BLACK%7D%20%7D%0D--%20%28gets%20finished%20in%20build_level%28%29%20%29%0D%0Dcurrent_color%20%3D%200%0Dplayer%20%3D%20%7Bx%3D0%2Cy%3D-50%7D%0D%0D--%20Startup%20code%20goes%20here%0Dfunction%20init%28%29%0D%20%20%20%20reset_flash%28%29%0D%09math.randomseed%28%20os.time%28%29%20%29%0D%09build_level%28%29%0Dend%0D%0Dfunction%20build_level%28%29%09%09%09%20%20%0D%09level%20%3D%20%7B%20%22YYYYYYYYY%22%2C%20%0D%09%09%09%20%20%22YCMCMCBCM%22%2C%0D%09%09%09%20%20%22CBYYBYCMC%22%2C%0D%09%09%09%20%20%22MYCMCYMYC%22%2C%0D%09%09%09%20%20%22MCMCYBBMC%22%7D%0D%09y%20%3D%2050%0D%09for%20_%2Crow%20in%20ipairs%28level%29%20do%0D%09%09x%20%3D%20-40%0D%09%09for%20i%20%3D%201%2C%20string.len%28row%29%20do%0D%09%09%09local%20letter%20%3D%20string.sub%28row%2Ci%2Ci%29%0D%09%09%09walls%5B%20%23%20walls%20+%201%5D%20%20%3D%20%7Bx%3Dx%2C%20y%3Dy%2C%20w%3D8%2C%20h%3D8%2C%20t%3Dletter_to_type%28letter%29%7D%0D%09%09%09x%20%3D%20x%20+%2010%0D%09%09end%0D%09%09y%20%3D%20y%20+%2010%0D%09end%0Dend%0D%0D--%20Update%20loop%20goes%20here%0Dfunction%20update%28%20delta%20%29%0D%09sim%28delta%29%0D%09render%28%29%0Dend%0D%09%0D--%20I%20am%20too%20tired%20for%20comments.%0Dfunction%20sim%28delta%29%0D%09player_control%28delta%29%0D%09background%28delta%29%0D%09winning%28%29%0Dend%0D%0Dfunction%20winning%28%29%0D%09if%20player.y%20%3E%20100%20then%0D%09%09goto%28%22cake%22%2C%20%22cake%20is%20yours%22%2C%20%22GDC%20Towlr%22%2C%20%22http%3A//excitemike.com/GDC_Towlr%22%29%0D%09end%0Dend%0D%0Dfunction%20player_control%28delta%29%0D%09player.x%20%3D%20player.x%20+%20%28%20%28right-left%29%20*%20PLAYER_SPEED%20*%20delta%29%0D%09player.y%20%3D%20player.y%20+%20%28%20%28down-up%29%20*%20PLAYER_SPEED%20*%20delta%29%09%0Dend%0D%0Dfunction%20background%28delta%29%0D%09countdown%20%3D%20countdown%20-%20delta%0D%09if%20countdown%20%3C%3D%200%20then%0D%09%09reset_flash%28%29%0D%09end%0Dend%0D%0D--%20%0Dfunction%20render%28%29%0D%09draw_background%28%29%0D%09draw_player%28%29%0D%09draw_and_collide_walls%28%29%0D%09%0D%09draw_cross%28%29%0Dend%0D%0Dfunction%20draw_and_collide_walls%28%29%0D%09for%20_%2Cwall%20in%20ipairs%28walls%29%20do%0D%09%09if%20not%20wall.dead%20then%0D%09%09%09draw_wall%28wall%29%0D%09%09%09collide_wall%28wall%29%0D%09%09end%0D%09end%0Dend%0D%0Dfunction%20draw_wall%28wall%29%0D%09h%2C%20s%2C%20v%20%3D%20get_wall_hsv%28wall%29%0D%09draw%28h%2Cs%2Cv%2C%20wall.x%2C%20wall.y%2C%20wall.w%2C%20wall.h%29%0Dend%0D%0Dfunction%20collide_wall%28wall%29%0D%09xdiff%20%3D%20%28player.x%20-%20wall.x%29%0D%09ydiff%20%3D%20%28player.y%20-%20wall.y%29%0D%09if%20%20%28%20math.abs%282*xdiff%29%20%3C%20%28wall.w+PLAYER_SIZE%29%20%29%20%0D%09and%20%28%20math.abs%282*ydiff%29%20%3C%20%28wall.h+PLAYER_SIZE%29%20%29%20%0D%09then%0D%09%09handle_wall_collision%28wall%29%0D%09end%0Dend%0D%0Dfunction%20handle_wall_collision%28wall%29%0D%09if%20wall.t%20%3D%3D%20WALL_TYPE_BLACK%20then%0D%09%09lose%28%29%0D%09elseif%20wall.t%20%3D%3D%20current_safe_wall%20then%0D%09%09wall.dead%20%3D%20true%0D%09%09current_safe_wall%20%3D%20%28current_safe_wall%20+%201%29%20%25%20WALL_TYPE_BLACK%0D%09%09beep%280%2C1%2C0%2C0%29%0D%09%09beep%28-2%2C1%2C0%2C3%29%0D%09%09beep%28-3%2C1%2C0%2C4%29%0D%09else%0D%09%09lose%28%29%0D%09end%0Dend%0D%0Dfunction%20lose%28%29%0D%09beep%2812%2C%201%2C%200%2C%200%29%0D%09beep%2813%2C%201%2C%200%2C%200%29%0D%09%0D%09beep%2824%2C%201%2C%200%2C%201%29%0D%09beep%2812%2C%201%2C%200%2C%201%29%0D%09beep%2813%2C%201%2C%200%2C%201%29%0D%09%0D%09beep%2813%2C%201%2C%200%2C%202%29%0D%09beep%2812%2C%201%2C%200%2C%202%29%0D%09beep%2813%2C%201%2C%200%2C%202%29%0D%09%0D%09beep%2823%2C%201%2C%200%2C%203%29%0D%09beep%2812%2C%201%2C%200%2C%203%29%0D%09beep%2813%2C%201%2C%200%2C%203%29%0D%09%0D%09beep%2812%2C%201%2C%200%2C%204%29%0D%09beep%2812%2C%201%2C%200%2C%204%29%0D%09beep%2813%2C%201%2C%200%2C%204%29%0D%09%0D%09beep%2824%2C%201%2C%200%2C%205%29%0D%09beep%2812%2C%201%2C%200%2C%205%29%0D%09beep%2813%2C%201%2C%200%2C%205%29%0D%09%0D%09reset_everything%28%29%0Dend%0D%0Dfunction%20get_wall_hsv%28wall%29%0D%09local%20h%3D0%0D%09local%20s%3D0%0D%09local%20v%3D0%0D%09%0D%09s%20%3D%201.0%0D%09v%20%3D%201.0%20-%20math.random%284%29%20*%200.025%0D%09%09%0D%09if%20%20%20%20%20wall.t%20%3D%3D%20WALL_TYPE_YELLOW%20%20then%0D%09%09h%20%3D%201/6%0D%09elseif%20wall.t%20%3D%3D%20WALL_TYPE_CYAN%20%20%20%20then%0D%09%09h%20%3D%203/6%0D%09elseif%20wall.t%20%3D%3D%20WALL_TYPE_MAGENTA%20then%0D%09%09h%20%3D%205/6%0D%09elseif%20wall.t%20%3D%3D%20WALL_TYPE_BLACK%20%20%20then%0D%09%09s%20%3D%200%0D%09%09v%20%3D%20math.random%284%29%20*%200.05%0D%09end%0D%09%0D%09return%20h%2C%20s%2C%20v%0Dend%0D%0Dfunction%20letter_to_type%28letter%29%0D%09if%20letter%3D%3D%22Y%22%20then%0D%09%09return%20WALL_TYPE_YELLOW%0D%09elseif%20letter%3D%3D%22C%22%20then%0D%09%09return%20WALL_TYPE_CYAN%0D%09elseif%20letter%3D%3D%22M%22%20then%0D%09%09return%20WALL_TYPE_MAGENTA%0D%09else%0D%09%09return%20WALL_TYPE_BLACK%0D%09end%0Dend%0D%0Dfunction%20draw_player%28%29%0D%09h%20%3D%20math.random%2810%29%20*%200.1%0D%20%20%20%20draw%28%20h%2C%200.15%2C%200.7%2C%20player.x%2C%20player.y%2C%202*PLAYER_SIZE%2C%202*PLAYER_SIZE%29%0D%20%20%20%20draw%28%20h%2C%200.00%2C%201.0%2C%20player.x%2C%20player.y%2C%20PLAYER_SIZE%2C%20PLAYER_SIZE%29%0Dend%0D%0Dfunction%20draw_background%28%29%0D%09draw%28%20HUES%5Bcurrent_color%20+%201%5D%2C%200.9%2C%200.9%2C%200%2C%200%2C%20300%2C%20200%20%29%0Dend%0D%0Dfunction%20draw_cross%28%20%29%0D%09draw%280%2C%200%2C%201%2C%200%2C%200%2C%2030%2C%20%204%29%0D%09draw%280%2C%200%2C%201%2C%200%2C%200%2C%204%2C%20%2030%29%0Dend%0D%0Dfunction%20reset_flash%28%29%0D%09countdown%20%3D%20BG_CHANGE_DELAY%0D%09current_color%20%3D%20current_color%20+%201%0D%09current_color%20%3D%20current_color%20%25%20NUM_HUES%09%0Dend%0D%0Dfunction%20reset_everything%28%29%0D%20%20%20%20player.x%20%3D%200%0D%09player.y%20%3D%20-50%0D%09%0D%09for%20_%2Cwall%20in%20ipairs%28walls%29%20do%0D%09%09wall.dead%20%3D%20false%0D%09end%0D%09%0D%09current_safe_wall%20%3D%200%0Dend%0D%0D!!!END!!!I Made a Towlr at GDC!!!END!!! !!!TICKYTACKY!!!cake!!!TICKYTACKY!!! walls%20%3D%20%7B%20%7Bx%3D%20%200%2C%20%20y%3D%20%200%2C%20w%3D300%2C%20h%3D200%7D%2C%0D%20%20%20%20%20%20%20%20%20%20%7Bx%3D-30%2C%20%20y%3D-30%2C%20w%3D8%2C%20h%3D48%7D%2C%0D%20%20%20%20%20%20%20%20%20%20%7Bx%3D%20%200%2C%20%20y%3D-30%2C%20w%3D8%2C%20h%3D48%7D%2C%0D%20%20%20%20%20%20%20%20%20%20%7Bx%3D%2030%2C%20%20y%3D-30%2C%20w%3D8%2C%20h%3D48%7D%2C%0D%20%20%20%20%20%20%20%20%20%20%7Bx%3D%20%200%2C%20%20y%3D%2020%2C%20w%3D200%2C%20h%3D48%7D%2C%0D%20%20%20%20%20%20%20%20%20%20%7Bx%3D%20%200%2C%20%20y%3D%2070%2C%20w%3D200%2C%20h%3D48%7D%20%7D%0D%0D--%20Startup%20code%20goes%20here%0Dfunction%20init%28%29%0D%20%20%20%20reset_flash%28%29%0D%09build_level%28%29%0Dend%0D%0D--%20Update%20loop%20goes%20here%0Dfunction%20update%28%20delta%20%29%0D%09sim%28delta%29%0D%09render%28%29%0Dend%0D%09%0D--%20I%20am%20too%20tired%20for%20comments.%0Dfunction%20sim%28delta%29%0Dend%0D%0D--%20%0Dfunction%20render%28%29%0D%09draw_background%28%29%0D%09draw_walls%28%29%0D%09%0D%09draw_cross%28%29%0Dend%0D%0Dfunction%20draw_walls%28%29%0D%09for%20_%2Cwall%20in%20ipairs%28walls%29%20do%0D%09%09draw_wall%28wall%29%0D%09end%0Dend%0D%0Dfunction%20draw_wall%28wall%29%0D%09h%2C%20s%2C%20v%20%3D%20get_wall_hsv%28wall%29%0D%09draw%28h%2Cs%2Cv%2C%20wall.x%2C%20wall.y%2C%20wall.w%2C%20wall.h%29%0Dend%0D%0D%0Dfunction%20get_wall_hsv%28wall%29%0D%09local%20h%3D0%0D%09local%20s%3D0%0D%09local%20v%3D0%0D%09%0D%09s%20%3D%200%0D%09v%20%3D%20math.random%284%29%20*%200.05%0D%09%0D%09return%20h%2C%20s%2C%20v%0Dend%0D%0D%0Dfunction%20draw_background%28%29%0D%09draw%28%20math.random%2820%29*0.05%2C%200.9%2C%200.9%2C%200%2C%200%2C%20300%2C%20200%20%29%0Dend%0D%0Dfunction%20draw_cross%28%20%29%0D%09draw%280%2C%200%2C%201%2C%200%2C%200%2C%2030%2C%20%204%29%0D%09draw%280%2C%200%2C%201%2C%200%2C%200%2C%204%2C%20%2030%29%0Dend%0D%0D !!!END!!!cake!!!END!!!