Home Docs Examples Download
[CODE]
This page is for writing JavaScript code.
When you tap the [Run] button, the current code will be executed.

- Buttons
Sh... Shift
Hm... Home
En... End
Tm... Insert a template
Ky... Keyword suggestion
Rt... Enter
Dl... Delete

When you tap the [Sh], the following buttons appear.
Sl... Select start
Cp... Copy
Ps... Paste
Ld... Delete a line
Lc... Copy a line
Ly... Copy a line and replace x to y
Jp... Jump
Fi... Find, Format: {find text}
Fn... Find next
Rp... Replace, Format: {find text}replace text
Rn... Replace next
Sp... Insert sprite definition function
Au... Insert audio load function

[SPRITE]
This page is for drawing sprites.

- Buttons
Ad... Add a character
Dl... Delete a character
Cp... Copy a character
Ps... Paste a character
Pn... Cycle a pen kind. Pn:Pen Fl:Fill Rp:Replace
Rt... Rotate
Fv... Flip virtical
Hv... Flip horizonal
Sh... Shift
U.... Cycle a shift direction
Er... Erase a current character
Un... Undo
Cl... Change a color palette

[SYSTEM]
- Width
Number of columns in the CODE page

- Export
When you tap the [Export] button, a zip file containing the current code and the resources used is output. By unpacking it to any web server, it can be run with a web browser.


* Functions
[Audio]
- sndload(audio number,filename,[play]): loads a ogg file into the specified audio number. play:0=not play when loaded 1=play 2=loop
- sndloop(audio number): plays and loops the specified audio number continuously.
- sndplay(audio number): plays the specified audio number continuously.
- sndstatus(audio number): retruns the status of the specified audio number. -1,-2,-3=loading 0=ready 1=playing
- sndstop(audio number): stops the specified audio number.

[Core]
- bgcolor(color): changes the background color.
- include filename: inserts an external file.
- setscreen(width,height): changes the screen size.
- setwait(millisecond): sets a loop delay.
- time(): returns the numeric value corresponding to the time for the specified date according to universal time.

[Graphics]
- bgbegin(): begins drawing the graphic.
- bgend(): ends drawing the graphic.
- box(x,y,width,height,color): draws a filled box.
- circle(x,y,radius,color,fill): draws a circle. fill:0=not fill 1=fill
- line(x1,y1,x2,y2,color): puts a line.
- rectangle(x,y,width,height,color): draws a rectangle.
- rgb(r,g,b): returns a rgb string like #rrggbb.

[Math]
- abs(number): returns the positive equivalent of a value.
- atan2(radian,radian): returns the arctangent of the quotient.
- cos(radian): returns the cosine of a value.
- int(number): rounds the specified real number down to the nearest value.
- rand(number): returns a random number between 0 and the number-1.
- rnd(): returns a floating-point, pseudo-random number in the range 0 to 1.
- sin(radian): return the sine of a value.
- sqr(number): returns the square root of a value.
- tan(radian): returns the tangent of a value.

[Sprite]
- chkt(move pattern,sprite number,size): returns a one if the specified sprite is overlapping the another sprite.
- cls(): deletes all sprites.
- delt(sprite number): deletes the specified sprite.
- offset(x,y): shifts the position of the drawn image without affecting the coordinate of the specified sprite.
- putc(x,y,image number,[frame number],[size]): draws a sprite.
- sett(x,y,image number,move pattern,[frame number]): generates a sprite and returns the sprite number.
- sprite(image number,filename,number of frames,[width],[height]): loads a sprite into the specified image number

[Text]
- asc(string): produces an ASCII character number from the string provided.
- chr(number): returns a character string from the ASCII character number.
- len(string): returns the number of characters in the string provided.
- lower(string): returns a string converting the specified string to lowercase.
- mid(string,start,length): extracts a string from the string provided.
- print(x,y,sting): prints a text and returns the sprite number.
- settext(sprite number,string): changes a text.
- sprintf(string,value,value,,,): returns the formatted string.
- upper(string): returns a string converting the specified string to uppercase

[3D]
- chkm(move pattern,object number,size): returns a one if the specified object is overlapping the another object.
- delm(object number): deletes the specified 3D object.
- maprepeat(object number,x,y): sets the number of texture repeats.
- setcam(x,y,z,rotation x,rotation y,rotation z): sets the position of the camera.
- setm(x,y,z,image number,move pattern,[frame number]): constructs a 3D object from a single sided flat mesh.
- setmCone(x,y,z,c,image number,move pattern,[frame number],[radius],[height]): constructs a 3D object from a cone mesh.
- setmCube(x,y,z,image number,move pattern,[frame number],[width],[height],[depth]): constructs a 3D object from a cube mesh.
- setmCylinder(x,y,z,image number,move pattern,[frame number],[top radius],[buttom radius],[height]): constructs a 3D object from a cylinder mesh.
- setmPlane(x,y,z,image number,move pattern,[frame number],[width],[height]): constructs a 3D object from a plane mesh.
- setmSphere(x,y,z,image number,move pattern,[frame namber],[radius],[width],[height]): constructs a 3D object from a sphere mesh.
- setmTorus(x,y,z,image number,move pattern,[frame number],[radius],[tube],[radius segments],[tube segments]): constructs a 3D object from a torus mesh.

* Functions called
- init(): called once at startup.
- move(sprite number): called regularly for each sprite.
- update(): called on a regular basis.
- mousedown(x,y): called when the screen is tapped.
- mouseup(x,y): called when the tap is over.

* Global variables
[Sprite]
tm: maximum sprite number used
t[]: move pattern. When 0 is set, the sprite disappears.
tx[],ty[],sx,sy: position
txx[],tyy[],sxx,syy: any
tr[],sr: rotation. 0 to 359
ts[],ss: scale. 1=original size.
ta[],sa: alpha. 0 to 255
th[],sh: any
th2[]: any
tl[],sl: any
tl[2[]: any
tc[]: image number
tn[]: frame number
tsx[],tsy[]: any

[3D]
mm: maximum object number used
m[]: move pattern. When 0 is set, the object disappears.
mx[],my[],mz[],sx,sy,sz: position
mxx[],myy[],mzz[],sxx,syy,szz: any
mrx[],mry[],mrz[],srx,sry,srz: rotation
ms[],ss: scale. 1=original size.
ma[],sa: alpha. 0 to 255
mh[],sh: any
mh2[]: any
ml[],sl: any
ml2[]: any
mc[]: image number
mn[]: frame number
msx[],msy[],msz[]: any
cax,cay,caz: camera position
carx,cary,carz: camera rotation
fps: 60/frame rate

You can manipulate the sprites and 3D objects by updating these global variables. The variables starting with s- are variables you can use in the move() function.

[Others]
rsi: the collided sprite number
rsx,rsy,rsz: the position of the collided sprite
scx,scy: screen size
pi: 3.14159

* Tips
- [Sh]+[Hm] moves the cursor to the beginning of the file.
- [Sh]+[En] moves the cursor to the end of the file.
- The template will display the files whose beginning matches the word at the cursor position. If there is no matching file, it displays all the templates.
- Placing an ogg file in the audio directory, it can be played. You can insert a function to load it with the [Au] button in the code editor.
- Placing a png file created with another tool in the image directory, it can be used. It is necessary to specify the size as the argument in the sprite() function.
- You can use Javascript's standard built-in objects such as Math and Date.
- The sprite functions and The 3d functions can not be used at the same time. The setcam will start 3D mode.


2018 N.I