Questions tagged [pico-8]

Pico-8 is a virtual machine and fantasy console for making, sharing and playing tiny games. Users create "cartridges" through a Lua-based environment.

Here is the Pico-8 homepage: https://www.lexaloffle.com/pico-8.php

27 questions
0
votes
1 answer

Why has x become a nil value when I haven't touched it?

I'm learning lua using pico8 by making a platformer, but now that I have added gravity, this error: Runtime Error line 19 tab 0 local x1=p.x/8 Attempt to perform arithmetic on field 'x' (a nil value) pops up when the sprite collides with an item…
Yalc06
  • 1
  • 1
0
votes
1 answer

Attempt to index a nil value in TIC-80

I have two objects that are colliding, and when they do collide, it causes an error. Here is the error: [string "function _init()..."]:178: attempt to index a nil value (local 'sprite1') I am checking every single frame for a collision between the…
Sam Cao
  • 1
  • 2
0
votes
1 answer

Attempt to compare nil with number

I was doing a tutorial in pico8 just a while ago when I ran into this problem when I ran the code: "Attempt to compare nil with number" It was specifically refering to line 134, so I am assumming that it refering to the "x" as being nil. However, I…
Sam Cao
  • 1
  • 2
0
votes
2 answers

Lua/pico8: Converting str to variable without access to _G table

I'm looking to iterate over some similarly named variables. a_1,a_2,a_3=1,2,3 So that instead of using: if a_1>0 then a_1-=1 end if a_2>0 then a_2-=1 end if a_3>0 then a_3-=1 end I can do something like: for i=1,3 do if a_'i'>1 then a_'i'-=1 end…
kite
  • 309
  • 2
  • 12
0
votes
1 answer

Transferring 2d boundaries onto its 1d grid

I have a matrix defined mxn 128x128. And I have translated my 2d x,y positions onto this 1D matrix grid. My 2d coordinates accept positions using numbers 0->127 i.e. any combo in ranges {x=0,y=0}-->{x=127,y=127}. I'm implementing algorithms that…
kite
  • 309
  • 2
  • 12
0
votes
1 answer

Lua equivalent of dictionary.get() method?

How do I access a dictionary using a parameter? In python I can do dictionary.get(param) Is there an equivalent to this in lua? I want to do something like this: function make_object_from_flag(x, y, flag) local flag_obj = { [1] =…
0
votes
1 answer

Raycasting bends the World wierdly. PICO-8. (LUA)

I am trying to make a Wolfenstein3D-like game, using pico-8 (that's a 2d engine with many limitations) and the world just bends very weirdly. Gif of running around My code: (Warning LUA! Confusing language. starts counting at 1...! ) function…
Nizart
  • 1
  • 1
0
votes
1 answer

Coding error in Pico 8 code (lua). (Newbie here)

I have recently started coding and wanted to try out Pico-8. A game development platform that uses Lua. I watched tutorials on how to create a platformer and have run into an obstacle with my code. Spid in the code is the name of my main sprite and…
Pterrible
  • 11
  • 2
0
votes
1 answer

Html issue Iframe,Canvas

I use this gameengine pico8 and you can export a html version of your game. I put it in on my website but now every other iframe frome my website isn´t working the way it should anymore i guess the code from pico8 messed something up but im not…
Delidragon
  • 165
  • 4
  • 17
-1
votes
1 answer

How do I keep the speed of items in a table constant and make them stop moving after I release a button?

I am following a shoot-em-up game tutorial,and I ran into this problem where I want the speed of the stars go faster when I press the up button while they keep their separate colors. Also, the stars should slow down after I release the button.Right…
Sam Cao
  • 1
  • 2
-1
votes
2 answers

'then' expected near ',' but I already place then with Lua

As a complete beginner I'm experimenting on a small code on Pico-8 : function _update() if p.x, p.y == 64, 45 then cls() print("dead", 37, 70, 14) end end And when I try to run the program an error message appear which says : 'then' expected…
The_berrichon
  • 11
  • 1
  • 3
-2
votes
1 answer

lua, iterating and calling all same-named-functions of n=3 tiers of tables

Say I have multiple tables in {game} like {bullets}, where {bullets} has multiple tables as found below. How would I iterate through and call all the update functions contained in {game}? --Below is a simplified example, Assume each table in…
kite
  • 309
  • 2
  • 12
1
2