This is a demo on how to display the cards in a player's hand. Hope you find this useful!
--the amount of room for the cards to be in hand_width = 96 --the size of the room in pixels room_width = 128 --number of cards on screen card_num = 0 --the width of the card in pixels card_width = 12 --how many cards until they compress card_fit_num = flr(hand_width/card_width) function _update() --update card_num if btnp(❎) then card_num += 1 end if btnp(🅾️) and card_num > 0 then card_num -= 1 end --update hand_width if btn(⬆️) then hand_width += 1 end if btn(⬇️) and hand_width > 12 then hand_width -= 1 end card_fit_num = flr(hand_width/card_width) end function _draw() --draw stuff cls(1) print("card num:"..card_num,43,50,6) print("x to add card",37,58) print("c to retract card",29,64) print("⬆️⬇️ to change hand size",15,70) line(room_width/2-hand_width/2-2,98,room_width/2-hand_width/2-2,117) line(room_width/2-hand_width/2+hand_width+1,98,room_width/2-hand_width/2+hand_width+1,117) line(room_width/2-hand_width/2-2,98,room_width/2-hand_width/2+hand_width+1,98) line(room_width/2-hand_width/2-2,117,room_width/2-hand_width/2+hand_width+1,117) --where the magic happens if card_num > card_fit_num then for i=0,card_num-1 do spr(1,(room_width/2-hand_width/2)+(hand_width-card_width)*(i/(card_num-1)),100,2,2) end else for i=0,card_num-1 do spr(1,(room_width/2-hand_width/2)+hand_width/2-(card_width*(card_num/2))+(i*card_width),100,2,2) end end end
The cart is completed! There are a few bugs with the seed menu but I'm too tired to mess with it anymore. If there are any game-breaking bugs please report them in the comments.
The song is an 8-bit remix of Amazing Plan by Kevin Macleod.
This is a cart based on I'll Take You To Tomato Town for my major project in school.
Random Seed Time: 00:31
Set Seed Time : XX:XX
Can you beat my times?
Arrow keys to move
X to show menu
C to toggle with shelves
X+C to shop minimap
Have to make my own experiment for a science assessment. I'm doing mine on how colour affects reaction time so I created this little cart to do so.
Made this game over the course of 2 days. I wanted to make something simple so I could familiarise myself with Lua so I made this. The best part is no matter where it spawns it will always hit the corner! Hope you guys enjoy. (Pls leave a star, I'd appreciate that :D)
Edit: Thank you so much for leaving such nice words about my game.
Update: Fixed a bug where if it spawned at x83 and moved right then it would clip out of the map.
this is my first game that I'm working on inspired by Tomb of the Mask. So far there's only 3 levels but there's more I want to do with this such as moveable boxes for puzzles and some hazards too.