From 3d591fadc3c0bfdcb32bee2e7b04f56f97eeb5b6 Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 3 May 2023 00:09:50 -0500 Subject: [PATCH] against started --- games/against.p8 | 120 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 games/against.p8 diff --git a/games/against.p8 b/games/against.p8 new file mode 100644 index 0000000..d98f5b6 --- /dev/null +++ b/games/against.p8 @@ -0,0 +1,120 @@ +pico-8 cartridge // http://www.pico-8.com +version 41 +__lua__ +-- +function _init() + --start_scene("title") + start_scene("level") +end + +function _update() + if _scene and _scene.update then + _scene.update() + end +end + +function _draw() + if _scene and _scene.draw then + _scene.draw() + end +end + +function start_scene(name) + _scene = _scenes[name] + _scene_start = time() + if _scene.start then + _scene.start() + end +end + +function scene_time() + return time() - _scene_start +end + +_scene = nil +_scenes = {} +_scene_start = 0 + +function draw_title() + cls() + print("title " .. scene_time()) +end + +function update_title() + if scene_time() > 2 then + start_scene("menu") + end +end + +function draw_menu() + cls() + print("menu " .. scene_time()) +end + +function update_menu() +end + + +function start_level() + walls = {} + walls[30]={{0,10}, {25,30}, {38,44}} + walls[40]={{5,15}, {20,25}, {40,50}} + walls[50]={{5,10}, {20,30}, {45,55}} + walls[60]={{5,15}, {20,25}, {40,50}} + walls[70]={{0,10}, {20,30}, {44,55}} + walls[80]={{5,15}, {20,25}, {40,50}} + walls[90]={{0,10}, {25,30}, {38,44}} +end + +function draw_side(right) + for y, platforms in pairs(walls) do + for plat in all(platforms) do + if right then + line(128-plat[1], y, 128-plat[2], y, DARK) + else + line(plat[1], y, plat[2], y, LIGHT) + end + end + end +end + +function draw_level() + --palt(0, false) + spr_frame = 1 + cls(0) + draw_side(false) + spr(spr_frame, 56, 100, 1, 2, false) + rectfill(64, 0, 128, 128, LIGHT) + draw_side(true) + pal({[LIGHT]=DARK}) + spr(spr_frame, 64, 100, 1, 2, true) + pal() +end + +function update_level() +end + +LIGHT = 6 +DARK = 0 +_scenes.title = {start=nil, draw=draw_title, update=update_title} +_scenes.menu = {start=nil, draw=draw_menu, update=nil} +_scenes.level = {start=start_level, draw=draw_level, update=update_level} + + +__gfx__ +00000000666660006666600006666600066666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000666660006666600006666600066666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700666660006666600006666600066666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000666660006666600006666600066666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000666660006666600006666600066666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700060000060600000600060000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000060000060600000600060000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066666660666666606066660066666600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066000000660000000666000000660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066000000660000000066000000660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066000000660000000066000000660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066000000660000000066000000660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066000000660000000066000000660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000066000000660000000066000000660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000606600006606000000660600006606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000600600006006000000600600006006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000