tiny Fantasy Console and JavaScript library for making tiny games or art
| |
---|---|
Display | 128x128 |
Cart | 2048 char |
Sound | ByteBeat |
Code | JavaScript |
Sprite | Not Supported |
- there are 2 types of cartridges
- by default the cartridge type is 2 but you can change it to first one by adding a "1" in the start of update tab
-
type 1 is a 32x32 plane that can be used to draw simple animations in 2D and 3D using the col for color output
x & y are inputs for the square that is getting colored
sx & sy are the outputs for drawing
sz is output used for sorting rectangles based on z-index
-
type 2 gives you full control to the whole screen
- the console is a javascript environment that will return results and errors of command.
-
(update) tab code will execute every frame
-
(wave) tab code is used to define the sound context output as a wave using t as input.
output wave has a sample rate that defines how many times the function should be excuted in 1 second that is defaultly 8000
it can be changed by adding the sample rate number at start of code and split from the next function with ",".
the output of wave function is a number from 0 to 256
Resolution :
<body res="n">
disable canvas and styles :<body init="f">
Adding sprite :<img id="sprite">
RGB to color :
rgb2color(r,g,b)
RGB to palette index :rgb2index(palette,r,g,b)
Draw a part of image :
spr(i,j,x,y,z)
sspr(x,y,w,h,x1,y1,w1,h1,r)
x,y drawing position
w,h,z drawing width,height,scale
x1,y1/i,j sprite position
w1,h1 sprite width,height
camera position :
camera(x,y)
set color of a pixel :pset(x,y,color)
get color of a pixel :pget(x,y)
RGB rectangle from palette :
pixs(x,y,r,g,b,s,w)
rectfill(x,y,w,h,c)
rectrot(x,y,w,h,c,r)
circfill(x,y,size,c)
trifill(x,y,x1,y1,x2,y2,c)
line(x,y,x1,y1,c,w)
rect(x,y,w,h)
circ(x,y,s,c,w)
cls(color)
Functions :
pow, sqrt, cbrt, sin, asin, cos, acos, tan, atan, atan2, rnd(range), flr, deg(Radians to degrees)
Rotate a point around pivot :
rot(x,y,r,cx,cy)
rot2(x,y,z,a,b,cx,cy,cz)
Scale :
scl(x,s,cx)
scl2(x,y,s,cx,cy)
Distance between 2 points :
dist3D(v1,v2)
dist2D(v1,v2)
Rotation between 2 points :
lookAt3D(v1,v2)
lookAt2D(v1,v2)
Bayer Matrix Arrays :
pixel8.bayer4[x%4][y%4]
pixel8.bayer8[x%8][y%8]
File :
getFile(url)
copyText(txt)
saveText(txt,name)
saveImage(img,name)
- pixel8
- canvas
- palette
- cameraX
- cameraY
- mouseX
- mouseY
- mouseStart