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 |
P#82481 2020-09-30 23:27
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
P#80222 2020-08-02 02:03 ( Edited 2020-09-11 13:48)
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.
P#79400 2020-07-16 04:46 ( Edited 2020-09-11 13:11)
To know how to play this game, check the official website to the card game this is based on.
https://www.ultraboardgames.com/get-bit/game-rules.php
P#74417 2020-04-02 10:51
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.
P#63493 2019-04-14 08:23 ( Edited 2019-05-20 09:43)