-
Notifications
You must be signed in to change notification settings - Fork 13
Standard language functions
sets the size of the Image using a multiplier indicating the size.Affects only the functions putimage, putimage, putimagerle
-
setimagesize(2.1)
;
sets the area in which the drawing and scrolling takes place. Does not affect sprites.
moves the Cursor to the Text screen co-ordinates denoted by x & y.
gotoxy(6,6);
scrolls the Screen in the direction indicated by dir. 2 = x – 1 (i.e. Left) 1 = y – 1 (i.e. Up) 0 = x+ 1 (i.e. Right) any other number = y + 1 (i.e. Down)
scroll(2);
delays the redrawing of the Screen for a small period of time
Clears the entire screen with the color setbgcolor. Does not affect sprites.
Changes the framerate in the range of 1-40 frames per second.
setframerate(40);
puts an image on the Screen. The image is denoted by address. The Screen co-ordinates by x & y, and the image width & height by w & h.
putimage(eat_spr, eatx * 3, eaty * 3, 3, 3);
puts a 1bit image on the Screen. The image is denoted by address. The Screen co-ordinates by x & y, and the image width & height by w & h.
putimage1bit(startscreen, 0, 16, 64, 32);
puts an RLE image on the Screen. The image is denoted by address. The Screen co-ordinates by x & y, and the image width & height by w & h.
putimagerle(earth, 0, 0, 16, 16);
changes the Palette colour denoted by n to the colour denoted by r5g6b5 (as an RGB value).
setpallette(14, 0xE718);
sets the current Pen colour to the colour from the Palette denoted by col (i.e. a value between 0 & 15).
setcolor(0);
sets the current Background colour to the colour from the Palette denoted by col (i.e. a value between 0 & 15).
setcolor(0);
returns the value for the Sprite specified in n, according to the type.
x = spritegetvalue(1, S_LIVES);
sets the value denoted by value of the type denoted by type for the Sprite denoted by n.
spritesetvalue(i, S_WIDTH, 8);
The available values for type are:
- S_X the x co-ordinate
- S_Y the y co-ordinate
- S_SPEEDX the Speed in the x direction
- S_SPEEDY the Speed in the y direction
- S_WIDTH the Width
- S_HEIGHT the Height
- S_IS_ONEBIT whether the Sprite is 1 bit, or not. 1 = True, 0 = False
- S_ANGLE the Angle of the Sprite (0-360)
- S_LIVES number of Lives for the Sprite
- S_COLLISION the ID of the Sprite that this Sprite is currently colliding with
- S_SOLID whether the Sprite is Solid, or not. 1 = True, 0 = False
- S_GRAVITY whether the Sprite is affected by Gravity, or not. 1 = True, 0 = False
- S_ON_COLLISION the Function to execute when the Sprite collides with another Sprite. NB: when entering the name of the Function, just use the name, not the brackets. For example, use bombcollision, not bombcollision().
- S_ON_EXIT_SCREEN the Function to execute when the Sprite moves off Screen. NB: when entering the name of the Function, just use the name, not the brackets. For example, use exit, not exit().
- S_IS_SCROLLED whether the Sprite is scrolled with the Screen, or not. 1 = True, 0 = False
- S_FLIP_HORIZONTAL flip Sprite horizontally 1 = True, 0 = False
returns the angle, in degrees, between the two Sprites denoted by n1 & n2.
x = angbetweenspr(1, 2);
gets the Sprite denoted by address (i.e. the name of the Sprite in its definition) and assigns it to the Sprite denoted by n.
getsprite(1, bird);
puts the Sprite denoted by n at the co-ordinates on the Screen denoted by x & y.
putsprite(1, 5, 60);
Sets the sprite to n speed in the direction (0 - 360 degrees).
spritespeed(1, 12, 120);
Gets the number of the sprite which is in the x & y position
puts a Pixel at the co-ordinates on the Screen denoted by x & y.
putpixel(stars.x,stars.y);
returns the contents of the Pixel at the co-ordinates denoted by x & y.
color = getpixel(x * 2, y * 2);
draws a line from point x&y to point x1&y1
draws a square from point x&y (top left corner) to point x1&y1 (bottom right corner)
draws a filled square from the point x&y (top left corner) to the point x1&y1 (bottom right corner).
draws a triangle between points x&y x1&y1 x2&y2
draws a filled triangle between points x&y x1&y1 x2&y2
draws a circle with its center at the x&y point and radius r
draws a filled circle with its center at the x&y point and radius r
prints a character to the Screen at the current x & y text co-ordinates.
putchar(10);
prints a 1-D char array to the Screen at the current x & y co-ordinates.
puts(“Press any key”);
prints an integer in decimal format
prints a line with a specified formatting. Supported %d (number int) %f (number fixed) %s (string) %c (character)
printf("a+b=%d", a + b);
gets a character from the keyboard. The program is interrupted and waits for the character to be entered.
Load the font picture and initialize the characters from first to end. The characters should follow the order according to ASCII.
loadfont(font1, 'a', 'z'); // the picture font1 contains letters A to Z, in ACII order (means A, B, C, D, etc.)
Sets the size of the font previously loaded.
setfontsize(32, 32, 8, 16); // the size of the picture is 32x32 and the size of each character is 8x16
Draws the text on the screen at coordinates x and y.
drawstring("lorem ipsum\ndolor sit amet", 9, 25); // the \n is a line-break
Draws the character on the screen at coordinates x and y.
drawchar("b", 6, 14);
loads a Tile denoted by address, setting the required width & height, based on the original width & height of the Tile (imgwidth & imgheight).
loadtile(maze, 8, 8, 15, 15);
draws a Tile at the Screen co-ordinates denoted by x & y.
drawtile(4 ,4);
If it is not used, the sprites' collisions with the tiles are checked against the tiles map. Otherwise, they are checked against the collision map. The collision map must be a single bit. Its size is the same as the size of the collision map.
gets the address of the image in a cell at x&y at the Screen co-ordinates denoted by x & y.
x = gettileinxy(x1, y1);
creates a Particle. The Gravity value is denoted by gravity, where a value of 0 denotes no Gravity and an integer value denotes the amount of Gravity (Added to the speed along the y axis every frame). The number of Particles to be displayed is set by count and the length of Time that the Particle should run for is set by time (in milliseconds).
setparticle(0, 4, 1000);
sets the Emitter for the Particle. The time for the Emitter to run is denoted by time (in milliseconds), the x direction is denoted by dir, the y direction is denoted by dir1 and the speed of the Particles is denoted by speed.
setemitter(50, angle - 10, angle + 10, 9);
sets the size of the emitter area (width, height) and the size of the sprite (size)
draws the Particle at the co-ordinates denoted by x & y and in the colour denoted by color.
drawparticle(64, 64, 6);
returns the value of the key currently being pressed on the keyboard. The value returned will be one of the following (the number in brackets is the integer value representing the key): KEY_UP (1), KEY_LEFT (4), KEY_DOWN (2), KEY_RIGHT (8), KEY_A (16), KEY_B (32), KEY_SELECT (64), KEY_START (128) NB: UP, DOWN, LEFT & RIGHT map to the Arrow keys or WASD, A is the z key, B is the x key SELECT is the c key and START is the v key.
key = getkey();
returns the current value of the Timer, in milliseconds, denoted by n. Total 8 timers from 0 to 7
x = gettimer(0);
sets the Timer denoted by n to the time, in milliseconds, denoted by time.
settimer(0, 1000);
Saves the array in flash memory. "name" indicates the name of the storage. Count indicates the number of bytes to be saved. (int and fixed contains two bytes, and the size of the array should be multiplied by two). Returns the number of bytes saved.
Uploads previously saved data under the name "name" to an array. Returns the number of bytes loaded.
Plays the sound at the right frequency for the right time.
Loads a melody in rtttl format into the player. isLoop can be 0 (play once) and 1 (play in a circle).
Play the melody
Pause the melody
Stop the melody
Returns sinus from angle (takes values in degrees from 0 to 360)
Returns cosinus from angle (takes values in degrees from 0 to 360)
Returns the distance between two points
Allocates memory by returning a pointer or 0 if no memory was allocated.
Releases previously allocated memory. Accepts pointer.
Copies Array2 to Array1 with a long "size"
char arr[] = {0,1,2,3,4}'
char buf[5];
memcpy(buf, arr, 5);
putn(buf[2]);