This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pico-8 cartridge // http://www.pico-8.com | |
| version 42 | |
| __lua__ | |
| -- I would create an enemy adder function that | |
| -- creates enemies at certain positions (basically spawn them in) | |
| function add_enemy(_x, _y, _type) | |
| -- if youw ant to store enemy properties, I'd do it here in an array | |
| -- for ex: | |
| --[[ | |
| local enemyData = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- here we modifiy the creation to accomodate | |
| -- the tutorial, where we are gonna show the | |
| -- player which stance beats what | |
| if tutorial > 0 then | |
| tutorial -= 1 | |
| if tutorial > 0 then | |
| -- based on which tutorial we are in, set the enemy stance so that is beatable | |
| -- by the other table inside the players code when we are about to resolve the fight | |
| local tutorialBeatTable = {MID_STANCE,LOW_STANCE, MID_STANCE, HIGH_STANCE} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- transiton effect is from DW from the lexaloffle bbs | |
| function draw_transition_effect() | |
| -- magic circle does the | |
| -- opposite of circfill and | |
| -- instead erases the outside | |
| -- of the circle first | |
| for i=64,transition,-1 do | |
| circ(32,32,i,11) | |
| circ(33,32,i,11) | |
| end--next i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a,h,v,t,w,d,l,b,e,p,r,k,eb,ht,ld=20,64,100,0,0,0,10,{},{},{},rnd,del,{},{},0 | |
| function ce(a,b,c,d,e) if (((a-b)*(a-b)) + (c-d)*(c-d) <= e*e) then return true else return false end end | |
| ::_:: | |
| if time() < 3 then goto title else | |
| cls()t+=1 | |
| if(t%2==1)add(b,{x=r(128),y=0,t=1,b=0,c=1+flr(r(2))*6}) | |
| if(t>30)then t,d=0,d+0.005 end | |
| if(w<time())then | |
| i={x=r(120),y=-2,t=r(3),s=r({1,2}),sp=time()+r()}add(e,i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- red starts from high stance | |
| -- for ex, let's say the start at a high stance | |
| enemy.finalStance = HIGH_STANCE | |
| local modifierCollection = {} | |
| -- let's roll a few modifires, which are | |
| -- showcased by the clue system for you | |
| -- to figure out | |
| for i=1,3 do | |
| -- roll a chance for it to even happen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- inside update: | |
| -- update opponent's attack timer | |
| if enemy.timeLeftForAttack > 0 then | |
| -- decrease the time till the opponent attacks | |
| enemy.timeLeftForAttack -= 1 | |
| -- let them switch around randomly to juke | |
| if (enemy.timeLeftForAttack > enemy.finalStanceHold) then | |
| if rnd() > 0.9 then | |
| enemy.stance = rnd({1,2,3}) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- draw a samurai on the screen at _x and _y positions | |
| -- _color holds a two element array for the palette swap | |
| -- _head holds the head sprite of the samurai | |
| -- _flip indicates two horizontally flip the whole thing | |
| -- for opponent drawing | |
| function draw_samurai(_x, _y, _color, _stance, _head, _flip) | |
| -- offset for heads, because the base sprite is not symetrical. | |
| local headOffset = {3,1} | |
| if _flip then headOffset = {5,1} end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Candidate List for my review Series: PicoShorts: https://github.com/Achie72/kofi-articles?tab=readme-ov-file#picoshorts | |
| Golf Escape by Davbo: https://www.lexaloffle.com/bbs/?pid=139431#p | |
| jetpack 1.2 by strirky: https://www.lexaloffle.com/bbs/?pid=139451#p | |
| Rover defence by ggaughan: https://www.lexaloffle.com/bbs/?pid=139475#p | |
| Cave Diving Gone Bad by taxicomics: https://www.lexaloffle.com/bbs/?pid=139584#p | |
| Bounce Game by SaKo: https://www.lexaloffle.com/bbs/?pid=139631#p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Bresenham's line + A* | |
| -- Made for Crumbling Crypt: https://ko-fi.com/Post/Crumbling-Crypt-1--A-minimalist-Roguelike-B0B1SPL7E | |
| -- calc manthattan distance, which is the grid based | |
| -- tile distance between two points | |
| function heuristic(a, b) | |
| return (abs(a.x - b.x)+ abs(a.y-b.y)) | |
| end | |
| -- Insertion Sort by @impbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Made for Crumbling Crypt: https://ko-fi.com/Post/Crumbling-Crypt-1--A-minimalist-Roguelike-B0B1SPL7E | |
| -- Original version for my game called Kumatori Panic!: https://ko-fi.com/post/Kumatori-Panic-4--Eggs-Better-Movement-Lore-Ac-N4N0N6K7W | |
| function build_room(corner_sprite_id, corner, _x, _y) | |
| --printh("building room at: ".._x.." ".._y) | |
| local idString = "" | |
| -- indicate where the given sprite starts on | |
| -- the sprite sheet. | |
| local xStart = 0 | |
| local yStart = 0 |