I am getting different results when invoking code in the console as opposed to calling it from inside a running program. The code overrides the default behaviour of the cos function.
pi=3.14159 two_pi=pi*2 -- override cos to work with radians p8cos = cos function cos(rad) return p8cos(rad/two_pi) end -- degrees to radians function d2r(d) return d*two_pi/360 end -- this test works (cos(45 deg) => 0.7071) function _draw() cls() print(cos(d2r(45))) end |
I then run the code, observing correct results (0.7071).
Invoking this from the console however: print(cos(d2r(45)))
prints different results (0.2206).
Are function overrides ignored in the console?
I'd like to learn from some of the carts here in this forum by loading them into Designer. Is that possible?
What are the actual steps one must follow to begin scripting in Voxatron?
EDIT
It was right in the API docs
EXAMPLE (global script)
- create a script object, add it to the room, and edit it.
old_draw = _draw function _draw() clv() old_draw() local dz = sin(time())*5 sphere(64,64,32+dz,8,7) end
|
Is it possible to configure the camera such that it follows the player in a game?
EDIT
via a script placed inside the player folder (will add code once I've got that worked out)
Is there a way to evaluate a function call stored as a string, say "cls(2)"? I tried
eval("cls(2)")
but nope; no such beast.


You owe money to the wrong people and you only have a few minutes to pay it back. Grab the money bags and drop them at the safe house. Don't get caught. Don't run out of fuel.
Inspired by Getaway!, a crime-themed game designed by Mark Reid and published for Atari 8-bit computers in 1982.
Screenshots


Controls
- up/down/left/right: drive/steer
- x : speed boost
Changelog
1.3
- minor UI and help text adjustments.
1.2
- easy level debt reduced to $2000, with a due date of 2 minutes.
- money bags sometimes appear closer to your location
I have a controller connected to my laptop. To configure pico-8 for it, I did : launch Gamepad Tool > Copy Mapping String > append string to sdl_controllers.txt > relaunch pico-8. This works well.
Now, I would like to use the controller's shoulder buttons as replacements for the d-pad's dpleft (btn 0) and dpright (btn 1), respectively. Can this be done at all? Note that this is not for exported (to html) games but rather to those launched from the pico-8 console.
EDIT:
To be clear, I'd like to control a pico-8 game using a gamepad's shoulder buttons.
EDIT2:
GamepadTool mapping string, as entered in sdl_controllers.txt is this:
03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
How do I create a middle c note in sfx 0 programmatically? I'm not sure on the formula to calculate the offset from 0x6000.
I want to control my pico game via html element event handlers. Given that, what memory address (pico8_gpio offset) must I poke at if I want to simulate a btn(0) event? Also, what's the offset for simulating additional player actions, say, btn(0,1)? Thanks.
Is there a shortcut for editor code tab switching? Couldn't find it in the docs.
(This may sound convoluted)
Is it possible to invoke an embedded ("export html") pico-8 program's functions from an external javascript file?
In this particular case, I wrote a .js app that fetches remote data asynchronously (via ajax). I then want to map that data to a sequence of pico-8 program function names, invoking each one in turn at regular intervals.
I often browse the pico-8 forums on my mobile. On my phone (Samsung S4), I have to squint like a maniac because the contents of the pages are not rescaled by the browser, which they would be if the following viewport meta was on each page:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> |
Can the person responsible for these forums (and web site in general) add that so that I can go back to "squintless" reading. :)
Cheers
Alex
Hi all.
The following code doesn't work -- players don't get drawn.
What am I doing wrong?
Thanks in advance.
Alex
players = {} function make_player(col) local p = {} p.x = 0 p.y = 0 p.color = col return p end function draw_player(p) rectfill(p.x-2,p.y-2,p.x+2,p.y+2,p.color) end function _init() players.home = make_player(1) players.visitor = make_player(8) end function _draw() cls() foreach(players, function(p) draw_player(p)) end |
Could someone explain how glitch effects similar to Benjamin Soulé's Mr.Beam were done? No code as much as an overview.
Thanks in advance.
Alex