Crash-tan
2.5.0 Released!
Crash BASIC 2.5.0 Release Notes
written by Crash-tan
Apple TV, collisions and the scene editor. A controller's Menu button
starts your game on Apple TV now, and its B button stops asking whether you
want to leave. The scene editor keeps everything in one tree at the left and
only the fields of what you pick at the right, a boundary's fields take your
typing, and a sprite can carry metadata from its scene file. And in Crash
BASIC 2, the sprite a collision handler runs for is thissprite again, as it
was in 1.x, so me means the player there too, and the reference says what
each value a collision handler is given holds.
A CONTROLLER'S MENU STARTS THE GAME ON APPLE TV
On an iPhone or iPad, a controller's Menu button reaches your game asSTART (JOYBUTTON(9)). On Apple TV it didn't reach your game at all: it
asked whether you wanted to leave. A game that waits for START on its
title screen couldn't be started with a controller, or with the remote.
Now a controller's Menu is START on Apple TV too, and so is the Siri
Remote's Play/Pause button, unless you've given it something else to do in
CrashPlayer's Controls.
ONLY THE REMOTE LEAVES A GAME IN CRASHPLAYER
Apple TV reports a controller's B button as a Menu press, so in CrashPlayer
B asked "Exit Game?" in the middle of play. On a controller with A and B the
other way round, that was A. Now only the Siri Remote's Menu leaves a game,
and the hint at the start of a game says so. A controller's Home button
stays Apple TV's: it goes to the Home screen.
A TV GAME YOU EXPORT LEAVES WHEN IT ENDS
An Apple TV game you export ends when your program does, and that's the
only way out I give it: the Siri Remote's Menu no longer asks "Exit Game?".
It reaches your program as SELECT (JOYBUTTON(8)) instead, so your game
can open its own pause or quit screen with it.
THE SPRITE IN A COLLISION IS thissprite
In Crash BASIC 2, I gave ONCOLLISION and AFTERCOLLISION the sprite they
run for as me. But me is also the player in a CrashNet game, so inside a
collision handler a multiplayer game couldn't read me.slot or me.ishost:me was a sprite's number there. In 1.x that sprite was alwaysTHISSPRITE, so that's its name again:
BEHAVIOR "shot"
ONCOLLISION
IF other_tag = "rock" THEN DISABLE SPRITE thissprite
END ONCOLLISION
END BEHAVIORother, tag, other_tag, edge and impact are as they were.
A game written for an earlier version doesn't have to change: it plays as it
was written, with me as its handler's sprite. I can tell which version a
game was written for. A cart says it, and a project folder now keeps it in
its .crashbasic.json (engineVersion). A game that doesn't say is taken to
be older than this one. Such a game gets its handler's sprite as thissprite
too, so code that's already current runs either way.
And when you open an older project in the IDE, I bring its code up to date
myself: each me that was a collision handler's sprite becomes thissprite.
A me in a string or a comment, me.slot and the like, and a me outside a
handler are left as they are. The console says which files I changed and how
many places, and the project is stamped with this version, so I do it once.
Importing an older cart does the same. Running old code as written won't last
for ever, so open your projects in this version and they'll stay current.
The reference used to name these and stop there. Now ONCOLLISION andAFTERCOLLISION say what each one holds, with a value it might have: other
is -1 for a boundary, edge is the face of the other thing that was hit
("TOP" for a sprite landing on a floor), and impact is the sprite's speed
from before the hit, like (0, 6.5) for a fall.
THE SCENE EDITOR IS ONE TREE AND ITS FIELDS
The scene editor's right side had five tabs, Node, Layers, Images,
Boundaries and Behaviors, and each mixed a list with the fields of what was
in it. So a scene with a lot of boundaries was a long scroll of cards, and
finding a layer meant leaving the sprite you were on.
Now the tree at the left has a section for each: Sprites, Layers, Images,
Boundaries and Behaviors, each folding down to its heading, with how many it
holds and a + to add one. Sprites are the tree of parents and children
they always were. Pick anything in the tree, or a sprite or a boundary on the
canvas, and the right side shows its fields, and only its. An item's ×,
or Delete on its right-click menu, takes it out of the file.
A BOUNDARY'S FIELDS TAKE YOUR TYPING
In the scene editor, a click anywhere on a boundary's card picked the
boundary, and that click got to the card before its fields did. So you
couldn't type in a boundary's Tag, or tick its boxes. Now its fields are
yours to click.
METADATA FOR A SPRITE IN A SCENE
A scene file could already give a node metadata, the values META sets andGETSPRITEMETA reads back, but the scene editor had nowhere to type it.
Now a node's page has Metadata: keyed values, with + Value to add one,
and the one value without a key. Type a number, true or false, a point
like (10, 20), or anything else for text.
WHAT A SPRITE IN A SCENE IS SOLID AGAINST
A scene file could already list the tags of the sprites a node bumps into
(solid_sprites, which is SET SPRITE's sprites), and make it solid
from one side only, but the scene editor had nowhere to set either. Now a
sprite's fields have Solid against: type a tag, or pick one the file's
sprites carry from +, and take one off with its ×. One way is
beside it, as a boundary has.
HOW A SPRITE IN A SCENE STARTS MOVING
The same went for how a node moves: a scene file could give it avelocity, a max_velocity and a max_acceleration, and the scene editor
couldn't. Now a sprite's fields have Velocity (how far it moves each
tick when the scene starts, which its behaviors carry on from), Max
velocity (the most it moves in a tick on each axis) and Max
acceleration (the most speed its ACCELERATION builds up). Each is off
until you tick it.
TAB INDENTS WHAT YOU PICKED
In the code editor, Tab with text picked put a tab in place of the text,
deleting it. Now Tab indents every line the pick touches and Shift+Tab takes
a step off each, with the same text still picked, as in other code editors.
With nothing picked, Shift+Tab takes a step off the cursor's line and Tab
indents to the next stop. A step is what the file already indents by: a tab,
or its spaces (four in a file with no indentation yet).
THE MUSIC EDITOR MAKES ROOM FOR HELP
With help open beside it, the music editor's toolbar ran past the edge of
its tab, and the patterns, tracks and piano roll below spread out under the
help panel. Now a group of the toolbar that doesn't fit goes on a row of its
own, and the editor keeps to its tab.
A FLOOD OF DEBUG PRINT NO LONGER HANGS THE IDE
A game that wrote DEBUG PRINT in a tight loop buried the IDE under more
lines than it could ever show, and the IDE stopped answering, in the browser
and on the desktop. Now a game that says more than the IDE can take in waits
for it, as a program writing to a terminal does: every line still arrives,
and the game runs at full speed again once it stops flooding. The console
keeps the newest 10,000 lines, and draws only the ones on screen.