Mouse functions
Makes global variables to read the current mouse position and the state of the three mouse buttons (click, release, held state).
Detecting button release instead of push can be useful when clicking and holding should have different outcomes.
Setup
To enable mouse mode, use mouseon() in _init() or after selecting the input mode. This activates the dev mode flag.
Getting mouse values
-
Run
updatemouse()in _update() - Optional: Run
mousetime()in _update() to fetch whether a mouse button is being held longer than a click
Global variables
These are the values produced by updatemouse() each tick.
mx,my: mouse position (0-127)
A simple function for inserting sprites in the middle of text on screen.
There's a second version that can also highlight text. I made them different to reduce overhead if you only need the first one.
prtspr() arguments:
txtbl: text table, combo of strings and sprite numbers. Example: {"hello",5,"world"}
x,y: line position
c: text color
spry: adjust sprite y pos (optional argument)
prtspr_2() arguments:
txtbl: text table, combo of strings and sprite numbers. Example: {"hello",5,"world"}
x,y: line position
ctx: text color
chi: highlight color
spry: adjust sprite y pos (optional argument)
cdrp: drop shadow color
A simple system for animating through sprites for things like walk cycles.
- start or stop
- loop or play once
- return to a rest sprite if stopped (standing still instead of mid stride)
- table w/ sprite sequence can define flip x/y to reuse spite
- large sprites supported (w/h)
- adjustable speed
check code tab 1 for importable code and tab 2 for example use.
Setup
Using a range of continuous frames
Simple example
guy = aspr:new({start=1,frames=6,spd=0.2,restfr=7})
- start : the sprite number of the first animation frame
- frames : number of frames in the loop (if not using a frame table place them in sequence on the sheet)
Layer Paint
A simple painting program with layers.
Controls
Mouse or button mode can be selected on the Start screen.
Mouse mode
| Button | Function | |
|---|---|---|
| lmb | : | Paint / click toolbar item |
| rmb | : | Select background color (right click on palette) |
| Hold ❎ | : | Draw straight lines |
| Hold 🅾️ (Z) | : | Quick actions popup menu |
| rmb | : | Pick color from canvas |
| rmb | : | Toggle layer visibility (right click on layer button) |
| ⬆️⬇️ | : | Adjust brush size |
Button mode
| Button | Function | |
|---|---|---|
| ❎ | : | Paint / click toolbar item |
| 🅾️ | : | Select background color (click on palette) |
| 🅾️ | : | toggle layer visibility (on layer button) |
| Hold 🅾️ | : | Quick actions popup menu |
Tools:





0 comments