Log In  
Log In  

I came up with several functions that I think would go good in pico8 and would reduce file size for larger games

--math
function ldirx(l,d)          --stands for lengthdirx accepts degrees and saves 2 chars per call
function ldiry(l,d)          --stands for lengthdiry accepts degrees and saves 2 chars per call
function plen(x0,y0,x1,y1)   --stands for pointlen and saves 16 chars per call
function pdir(x0,y0,x1,y1)   --stands for pointdir and saves 2 char per call
function wrap(x, y, z)       --stands for wrap and saves 66 chars per call
function range(v,a1,a2,b1,b2)--stands for rerange and saves 31 chars

--vectors                        
function vec(x,y)    --stands for vector and saves 16 chars per call
function vgetl(v)    --stands for vector get length and saves 26 chars per call if using plen
function vsetl(v,x,y)--stands for vector set length and accepts a vector or a len and deg and saves 134 chars
function vaddl(v,x,y)--stands for vector  += length and accepts a vector or a len and deg and saves 134 chars
function vsubl(v,x,y)--stands for vector  -= length and accepts a vector or a len and deg and saves 134 chars
function vmull(v,x,y)--stands for vector  *= length and accepts a vector or a len and deg and saves 134 chars
function vdivl(v,x,y)--stands for vector  /= length and accepts a vector or a len and deg and saves 134 chars
function vgetd(v)    --stands for vector get dir and accepts a deg and saves 24 chars
function vsetr(v,r)  --stands for vector set dir and accepts a deg and saves 43 chars
function vaddr(v,r)  --stands for vector  += dir and accepts a deg and saves 43 chars
function vsubr(v,r)  --stands for vector  -= dir and accepts a deg and saves 43 chars
function vmulr(v,r)  --stands for vector  *= dir and accepts a deg and saves 43 chars
function vdivr(v,r)  --stands for vector  /= dir and accepts a deg and saves 43 chars

--tables
function copy(v) --stands for copy and saves 152 chars

some notes..

  • while ldirx, ldiry, plen and pdir wouldn't save alot of space they would be easier to understand and would definitly be used by newer programmers
  • the wrap function would wrap numbers around a min and max value and would be useful besides just saving space

  • range is another useful function that would take 2 ranges of numbers and return a converted value between those ranges

  • vectors while I only posted 2d versions could actually be made to work with 3d as well by supplying a additional z, vector, length and direction.

  • copy would just return a deep copy of the table u give it and would make oop easier and take less space up in the cart
P#55218 2018-08-15 22:36 ( Edited 2018-08-18 02:52)

:: dw817

How about some rotation in there too ? Not just rotating sprites but rotating the mapper too.

Add CHR() and ASC() for 8-bit.

Command to bring up standard FILEBOX, can IMPORT or EXPORT external files in it.

Ability to have sprites that act like hardware, they appear on top of everything else and do not require the background beneath them to be refreshed.

Ability to import/export font used in IDE editor. Would be 4x6 pixels, 1-bit per pixel.

Ability to change the pitch of any played sound without having to create new sounds just for that one pitch.

Ability to have numbers greater than 32767, say long integer at -2147483647 to +2147483647.

Ability to have 60fps without requiring the function for it. Flip(60) for instance.

Add INSTR() and RINSTR() ability for strings.
Hex(), Oct(), and Bin() without requiring string input.

Fix Cstore() to work correctly in export to Online .JS/HTML, Offline .JS/HTML, Bin/EXE, Mac, Linux.

Change key repeat delay and speed not just for IDE but for BTNP() as well.

Likely there are further functions and features other customers and members would like to have.

Thanks for Pico-8 , Zep !

P#55221 2018-08-15 22:56 ( Edited 2018-08-16 02:56)

@Shadowblitz16
FYI if you are not aware, zep has already said that he considers PICO-8 to be API complete at this point (as of 0.1.11). So, sorry to be the bearer of bad news, but I imagine any additions to the existing small and cozy API are unlikely.

see https://www.lexaloffle.com/bbs/?tid=30219

P#55244 2018-08-16 13:22 ( Edited 2018-08-16 17:22)

thats too bad since pico8 has limited memory
but its definitely still fun to use

P#55265 2018-08-16 17:26 ( Edited 2018-08-16 21:26)
:: dw817

SB, you might move this to category "SUPPORT" so ZEP will be certain to see it.

P#55329 2018-08-17 11:59 ( Edited 2018-08-17 15:59)

i'm not sure how to do that :(

P#55353 2018-08-17 22:26 ( Edited 2018-08-18 02:26)
:: dw817

Hi SB:

  • Click EDIT at the top and you will have the ability to change category as this is your own personal thread.

Please let me know if you are still having difficulty with this.

P#55354 2018-08-17 22:52 ( Edited 2018-08-18 02:52)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-05-27 06:09 | 0.036s | 4194k | Q:25