Program Editor - untitled.bch
Ln 1, Col 1
Game Screen (320x240)
Barchan - indent 2 spaces, # = comment
Logic
Draw screen is 320x240
Games
Maps
RPG
Menus
Blueprints
Dictionaries
Physics
Maps paint in the Maps tab, then
Anim make frames in Sprites, add a Tag, then
FX
Music
Debug
Files + tab adds a file (all files run together); double-click renames; Save packs many files, maps and sprite animations into .bchwrap
Sound
Other
Ctrl+Enter runs. Ctrl+S saves. Ctrl+/ comments lines. Tab / Shift+Tab indents. Export makes a standalone game page. Errors jump to the bad line.
let x be 5 set x to 1 change x by 2make hero: x=10 y=20 w=16 h=16add 5 to list let list be [1,2] count(list)remove x from list clear list cull(list) pick(list)Logic
if/else if/else while repeat 5 times:for i from 1 to 10: for each t in list:to add a, b: then give a + b; call: do name(1,2) or use in a formulaevery 2 seconds: on click: on tick: on start:on press space: on hold left: on release space: key("left")Draw screen is 320x240
paint c box x,y,w,h,c circle x,y,r,c oval x,y,rx,ry,cring x,y,r,c,w line x1,y1,x2,y2,c,w pixel x,y,c triangle x1,y1,x2,y2,x3,y3,cwrite "hi", x, y, c, size size 1-6 (default 2); x can be "center"draw "sprite", x, y, scale, angle - made in Sprites tab; negative scale flipsalpha 0.5 fades what you draw next (1 = solid) shake 8 fps 60Games
scene "play": block runs only in that scene; go "over" switches; game.scene game.t (frames in scene)after 2 seconds: runs onceMaps
let m be tilemap(["###","#.#"], 16) drawmap m, {"#":"gray",".":"green"} (colors or sprite names)solid(m,x,y,w,h) wall test (extra arg = wall chars) tile(m,tx,ty) settile(m,tx,ty,"#")camera x, y scrolls the world; camera 0, 0 to draw the HUDRPG
textbox "Name", "text", chars (chars = typewriter) bar x,y,w,h,value,max,croll(2,6) dice chance(25) % move(o,tx,ty,speed) sortby(list,"y")drawframe "sheet",x,y,fw,fh,n,scale sprite sheets tune "c4 e4 g4 -", 120, yes music (yes = loop)Menus
screen 640, 360 sets the game size (default 320x240)if button("Go", x, y, w, h): draws a button; true when clickedpanel x,y,w,h stone panel wrap(text, width, size) list of lines over(x,y,w,h) mouse.click leave exits a functionBlueprints
define enemy: then indented hp = 3 props, on create: on tick: on destroy: to hurt n: (use self); define boss like enemy:spawn enemy: x=10 y=20 all("enemy") do kill(self) hits(self,"enemy") list of touching; instances tick after your main tickDictionaries
let d be {"hp": 5} d["hp"] set d["x"] to 1 keys(d) values(d) has(d,"k") size(d) remove "k" from d; lists/dicts may span linesPhysics
physics o, map uses o.vx o.vy, o.gravity (.4) o.bounce o.friction; sets o.onGround; jump(o, 7); map chars = one-way, / \ slopesMaps paint in the Maps tab, then
let m be loadmap("name") drawmap m drawfront m zone(m,x,y,w,h) trigger charAnim make frames in Sprites, add a Tag, then
play "hero","walk",x,y,scaleFX
emit "smoke",x,y,n (smoke sparks fire dust magic) weather "rain" (snow, none) darkness 0.6 light x,y,r,"#ffd080" each frameMusic
tune ["c4 e4 g4 -", {"wave":"triangle","notes":"c3 - g3 -"}, {"wave":"drums","notes":"k - s -"}], 120, yes (c4:2 = longer)Debug
pause halts the game and opens Vars; Step runs one frame; Vars shows variables + objectsFiles + tab adds a file (all files run together); double-click renames; Save packs many files, maps and sprite animations into .bchwrap
Sound
beep hz, ms, "sine" sfx "coin" (coin jump hit boom power laser lose)Other
say stop time() remember "k", v recall("k", default)mouse.x mouse.y mouse.down · rgb(r,g,b) upper lower str numrandom(a,b) hit(a,b) dist(x1,y1,x2,y2) angle(x1,y1,x2,y2) lerp(a,b,t) clamp abs floor ceil round sign sqrt log sin cos atan2 min max pow piCtrl+Enter runs. Ctrl+S saves. Ctrl+/ comments lines. Tab / Shift+Tab indents. Export makes a standalone game page. Errors jump to the bad line.
