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)



1

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:

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

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

https://www.lexaloffle.com/bbs/?tid=49724

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


1

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


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!


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!



[Please log in to post a comment]