Log In  

so right now i'm working on a game called raise a thing (raise a floppa clone) and there are some things that i can't find and its these two blocks from scratch

and these are the two blocks i always use to create save codes and other things

so if anyone knows if these exist in pico 8 lua and what they are please tell me

another thing is does anyone have a point towards (x,y,sx,sy) function that i can use with credit?

what i'm looking for is something that you give the sprites x, y, the x and y you want to point at, and it outputs a direction that can then be put through sine and cosine to be converted into movement

i'll credit you in the credits (i'll make a note in the games code to make sure i don't forget)

P#121253 2022-11-23 21:20


Hi @my_name_is_doof:

Two things really.

  1. You should either have purchased Pico-8.
  2. Or you are using the educational version found [HERE]

Also you should read HERE:


And if you are using the educational version, go HERE:


Accomplish all that and you'll be in a better position to understanding Pico-8.

P#121261 2022-11-23 21:25 ( Edited 2022-11-23 21:25)

to access an item from a table or a string, use brackets:

local items={"sword","shield","bow"}
local thing=items[1]

local initial=thing[1]
print(initial) -- "s"

doc: https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Tables

to get the angle between two points, learn about the atan2 function here: https://demoman.net/?a=trig-for-games

P#121279 2022-11-23 23:33 ( Edited 2022-11-23 23:34)

Ah, Scratch! I remember that... tool? Platform? ...I don't know what you would refer to that one as, but I DO remember using it for my first amateur programs.

(Not that I've even finished a proper game yet on any toolset. The closest I've ever gotten is the tower defense game on PICO-8 that I am still working on, but that's beside the point.)

Anyways, the syntax you are looking for is: TABLE_OR_STRING[NUMBER]

Or, take an example from my tower defense game: RNUM[STAGE], where STAGE is the selected stage and RNUM is an array of strings like {..."IV","V","VI","VII"...}

In newer versions of PICO-8, [] applies to strings as well, so STR="ZEP" STR[2] will return "E".

As for angles... I can't remember how I got my towers facing the correct direction, but @merwok seems to have linked the solution, so you should be fine there... oh, wow, stuff about making something slowly turn towards it intended direction? SWEET! Thanks, @merwok!

P#121278 2022-11-23 23:58

thank you both @Kaius and @merwok for the help! now i can make the slime ai and make that sspr anim a list and get rid of a bunch of tokens!

P#121338 2022-11-24 18:07 ( Edited 2022-11-24 18:13)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-12-09 23:08:27 | 0.062s | Q:16