Log In  

BBS > Community Superblog
All | Following | GIFs | Off-site

In what situations do you use these conversions?

hexnumber = '3xz'

--A
tonum(hexnumber,1)       : 768 (0x0300.0000)

--B
tonum("0x"..hexnumber,4) : 0 (0x0000.0000)

--C
tonum('0x'..hexnumber)   : -- NO VALUE --([nil])

Example
I want "nil" to be returned when I use a character as an identifier. Therefore, I use the "C" conversion.

hexstr = '108000789$'
hexval = TONORM(hexstr) -- Normalize the value [number boolian nil], otherwise it remains a string.
hextable = {}

if type(hexval) == 'string' then

 foreach(split(hexstr, 3), function(v)
  add(hextable, tonum('0x' .. v))
 end)

end

-- Handle hexadecimal conversions without being converted to numbers by normalization.
-- Only the value of number is stored in the hextable.
-- "$" is not stored.
3 comments


here's a demo cart showing off some different ways to handle input in grid-based games:

Cart #hojohiyomu-1 | 2022-02-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
41

controls:

  • move around with the arrow keys
  • change "chapters" in the pause menu (enter + arrow keys)
  • slow down the game speed (in the later chapters) in the pause menu

I made this cart as a companion to a blog post about input buffering

41
5 comments


I am playing around with the wander demo so I can experiment with y axis movement to make a beat em up style game but i still want to be able to jump (in cases to dodge and platform in certain sections)

Here is the code if any of you are wondering:

function _init()

x=24 y=24 -- position (in tiles)
dx=0 dy=0 -- velocity
f=0 -- frame number
d=1 -- direction (-1, 1)
acc=0.5
boost=.5
end

function _draw()
cls(1)

-- move camera to current room
room_x = flr(x/16)
room_y = flr(y/16)
camera(room_x128,room_y128)

-- draw the whole map (128⁙32)
map()

-- draw the player
spr(65+f, -- frame index
x8-4,y8-4, -- x,y (pixels)
1,1,d==-1 -- w,h, flip
)
end

function _update()

ac=0.1 -- acceleration

if (btn(⬅️)) dx-= ac d=-1
if (btn(➡️)) dx+= ac d= 1
if (btn(⬆️)) dy-= ac
if (btn(⬇️)) dy+= ac

-- move (add velocity)
x+=dx y+=dy

-- friction (lower for more)
dx =.7
dy
=.7

-- advance animation according
-- to speed (or reset when
-- standing almost still)
spd=sqrt(dxdx+dydy)
f= (f+spd*2) % 4 -- 4 frames
if (spd < 0.05) f=0

-- collect apple
if (mget(x,y)==10) then
mset(x,y,14)
sfx(0)
end

end

I wanted to add something along the lines of
--jump
if (btnp(x)) then
player.dy=player.boost

Am I missing something?

3 comments


Cart #arrowmania-4 | 2022-02-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Cart #amania_factory-0 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
15


Cart #amania_amania-0 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
15


Cart #amania_dropper-0 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
15


Cart #amania_world_f-0 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
15


[ Continue Reading.. ]

15
1 comment


Cart #two_knights-0 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

2 Knights

WIP of an arcade game I'm making with my kids.

Find the key in each room and carry it to the door to move on. Defeat all enemies in the room before moving on to find treasure, but don't stay around too long...

Controls

  • Arrow keys: move
  • Z: jump
  • X: attack/throw key
  • UP + attack: pick up/drop key
9
2 comments


Cart #picociv-7 | 2022-03-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
10

I'm making a serious effort to create a PICO-8 version of Sid Meier's Civilization. This is a challenge because the rules are complicated but I'm having fun and that's the primary reason to do anything.

Changelog

v0.6

  • Options menu
  • Initial city manager implementation
  • Implemented unit production selection

v0.5

  • Added units: Cannon, Chariot, Armor, Mech.Inf, Artillery, Sail
  • Added black border to cities that contain a unit
  • Minimap shows explored map, cities, active unit
  • Implemented tribal/goody hut
  • Show player gold
  • Fixed movement stuck bug

v0.4

  • Added units: Musketeers, Riflemen, Knights, Catapult
  • Fixed double movement bug

[ Continue Reading.. ]

10
8 comments


Cart #voronoi_gen-0 | 2022-02-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Very unoptimised voronoi generation - but actually has a menu with settings now.

0 comments


Cart #marsdefender-5 | 2022-03-03 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Hello all

New here.

I just started with PICO-8 and learning LUA 2 days ago.

I made a demo of Mars defender... Code needs cleanup and I'm not finished yet but it works pretty well for the time being.

Hope you like it! :)

UPDATE 04.03.2022: Release version 0.9. Changed year (yep we're indeed in 2022 :D) and created an endboss. Fixed various bits and bugs. Game is small with only 5 but I don't see the point in going for 100 waves.
UPDATE 24.02.2022: Changed the name. A few tweaks and bugfixes, faster response, graphics and particle explosions.
Worked on various game mechanics, player energy and collision, AI for the Aliens etc.

1
4 comments


I made this for use myself, because i couldn't find anything for this specific purpose. Thought I'd post it here in case anyone else gets some use out of it.

It converts a list of variables in the following format to a version optimised for tokens:

-- input
t=0
cam_x=0
cam_y=0
shake=0
floor=1
gold=0
current_music=-1
mode="splash"
title_s=1
lastdist=0
fadepos=0

-- output
t,cam_x,cam_y,shake,floor,gold,current_music,mode,title_s,lastdist,fadepos
=0,0,0,0,1,0,-1,"splash",1,0,0

To use it, paste the original variables into the cart and it will output the "crunched" version out to the clipboard.
Bit of a warning though, this format gets unreadable fast.

It also seems (in most cases) to work if some of the values are already in this format as it simply pairs what's before the equals with what's after, e.g.:

-- input
t=0
cam_x,cam_y=0,0
ey,et=256,0
shake=0

-- output

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=107532#p)
2
0 comments


Cart #mosezafze-0 | 2022-02-23 | Code ▽ | Embed ▽ | No License

0 comments


Here's an example of trying to add a continuous underscore to the #font_snippet alternate font. Printing works fine with \014\f7 but the font gets clipped by 1px on the right with \014\#1\f7
(color is irrelevant; the inclusion of \#(number) triggers it.

EDIT: see below for the fix.

1 comment


Wumple

Cart #wumpleisthegame-2 | 2023-03-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
23

A short arcade game thingy that kinda was a mash of Pacman and adventures of Lolo. Made for ToyBoxJam 3.

One day at work a mother comes in and says she's lost all 40 of her kids and 'requests' help. Dodge toasters, Snakes, and more and make your way back home.

Made by SmellyFishstiks
Pathfinding help from Luchak

Made for Toy box jam 3 (https://itch.io/jam/toy-box-jam-3)

changelog

V1

  • released

V2

  • Fixed stacked comment blocks crashing the game
  • Fixed crash occurring when actor tried to find a path and returned a #path of 0
  • Fixed Rescue ship not being centered when flying away
  • Fixed Wayback-Final having a time limit and thus a ghost that could force you to reset your score if it ate grifert

[ Continue Reading.. ]

23
6 comments


Cart #yehetokepa-6 | 2022-02-22 | Code ▽ | Embed ▽ | No License
31

A raycaster engine I used to make a quick pac-man demo, could still use some work but I'm happy with it. Hope you enjoy!

31
7 comments


Cart #sallyneptune-3 | 2022-10-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
23

My entry for Toy Box Jam 3, 2022. Help Sally Neptune escape from the evil Monocronies!

  • Move: arrow keys
  • Shoot and strafe: X. This will strafe if you are not targeting something, and will let you circle-strafe a target.
  • Jump: Z or C
  • Tips:
    • You will need keys to open doors.
    • Look for the giant Neptune coin to escape!
    • There are gun powerups around that will let your rainbow gun shoot faster. Try to find them all!

I've always wanted to make a game based on the cast.p8 demo, and this is it! I am very happy with how sprite occlusion turned out.

I wrote this game in multiple files, so it may be tough to read in the pico8 editor. When I get a repo up on github, I'll update this in case anyone wants to see how I made this. Enjoy!

[ Continue Reading.. ]

23
7 comments


Hello

this is my new working progress project. It is a platform and I am having fun with a bit of level designing.

Cart #platformino-1 | 2022-02-22 | Code ▽ | Embed ▽ | No License

0 comments


Cart #mozdobaw-2 | 2022-02-23 | Code ▽ | Embed ▽ | No License


Cart #mozdobaw-0 | 2022-02-22 | Code ▽ | Embed ▽ | No License

0 comments


Cart #fajufupuze-0 | 2022-02-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
11

Hi, this is my first Pico-8 game. It's a remake of the Dreamcast game ChuChu Rocket. This is a multiplayer game, best played with 2 controllers. The game contains 16 levels.

I've tried to make the code easy to follow so others can examine it and learn the techniques.

Instructions

Use the arrow keys to move your cursor.
Press the O button and a direction to place an arrow on the grid. Mice and cats will follow the arrows.
Steer the mice into your rocket (the red or green circle), and steer the cats into your opponent's rocket.
Mice score 1 point, or 50 points for a gold mouse. Cats remove 1/3 of your total score.
The round ends after 3 minutes and then moves to a new random map.

[ Continue Reading.. ]

11
0 comments


Cart #neatonexus-3 | 2022-02-23 | Code ▽ | Embed ▽ | No License
128

Time is all of a jumble and Captain Neat-O is trapped in the middle of it! Battle enemies, solve puzzles and find the tools you need to escape the Time Nexus and stop whoever is behind this nefarious plot.

Gain an extra heart for every 100 gems collected. There are 300 gems to collect in total but some of them are hidden in secrets areas so keep an eye out for walls look a little bit different.

This is an entry for Toy Box Jam 3 using the graphics, music and sound effect assets supplied as part of the jam.

Music by @gruber_music

Most art by @TobyThePoser

Updated to fixed a couple of things and make the final boss fight a bit shorter.

128
24 comments


Cart #hessery_motherload-0 | 2022-02-22 | Code ▽ | Embed ▽ | No License
1

Just a small demake of Motherload that I threw together in two afternoons.

1
0 comments


Cart #pasoyubatu-3 | 2022-02-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Hi all,
I wanted to share the first full game I made on PICO-8. It's a modern twist on the old Sopwith video game.

The purpose is to destroy all enemy factories. Can you successfully complete all three levels?

Instructions:
Right key to takeoff/afterburner
Left key to air brake
Up key to pull up
Down key to pull down
Z to fire main gun (unlimited)
X to drop bombs

From the secret menu:
If you tap both left and right keys at the same time, the plane will flip. It's not necessary as the plane will flip itself upright automatically when needed.

Fuel:
Make sure to check on your fuel level. Fuel and bombs can be replenished by landing at a friendly airbase.

[ Continue Reading.. ]

3
3 comments




Top    Load More Posts ->