mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-26 04:32:05 +00:00
Added move_backward blockly block.
This commit is contained in:
parent
26e7e1b119
commit
6b51dff8b9
@ -51,6 +51,7 @@
|
||||
<category name="Events">
|
||||
<block type="events_set_map"></block>
|
||||
<block type="events_teleport"></block>
|
||||
<block type="events_move_backward"></block>
|
||||
<block type="events_set_sky"></block>
|
||||
<block type="events_set_ground"></block>
|
||||
</category>
|
||||
|
@ -125,6 +125,18 @@ if (typeof Mythos === "undefined") {
|
||||
this.setTooltip('Teleport the player to a given location and direction on this map.');
|
||||
}
|
||||
};
|
||||
Blockly.Blocks['events_move_backward'] = {
|
||||
init: function() {
|
||||
this.setHelpUrl(Mythos.helpUrl);
|
||||
this.setColour(54);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.appendDummyInput()
|
||||
.appendField("Move backward");
|
||||
this.setOutput(false);
|
||||
this.setTooltip('Moves the player one step backward.');
|
||||
}
|
||||
};
|
||||
Blockly.Blocks['events_set_sky'] = {
|
||||
init: function() {
|
||||
this.setHelpUrl(Mythos.helpUrl);
|
||||
|
@ -1398,6 +1398,7 @@ class PackPartitions
|
||||
def vec_teleport = 0x315
|
||||
def vec_setPortrait = 0x318
|
||||
def vec_clrPortrait = 0x31B
|
||||
def vec_moveBackward = 0x31E
|
||||
|
||||
def emitAuxString(str)
|
||||
{
|
||||
@ -1522,6 +1523,8 @@ class PackPartitions
|
||||
packSetGround(blk); break
|
||||
case 'events_teleport':
|
||||
packTeleport(blk); break
|
||||
case 'events_move_backward':
|
||||
packMoveBackward(blk); break
|
||||
case 'graphics_set_portrait':
|
||||
packSetPortrait(blk); break
|
||||
case 'graphics_clr_portrait':
|
||||
@ -1791,6 +1794,16 @@ class PackPartitions
|
||||
emitCodeByte(0x30) // DROP
|
||||
}
|
||||
|
||||
def packMoveBackward(blk)
|
||||
{
|
||||
assert blk.field.size() == 0
|
||||
//println " Move backward"
|
||||
|
||||
emitCodeByte(0x54) // CALL
|
||||
emitCodeWord(vec_moveBackward)
|
||||
emitCodeByte(0x30) // DROP
|
||||
}
|
||||
|
||||
def makeInit(mapName, scripts, xRange, yRange)
|
||||
{
|
||||
//println " Script: special 'init'"
|
||||
|
@ -891,7 +891,12 @@ def moveForward()
|
||||
|
||||
// If not blocked, render at the new position.
|
||||
if val > 0
|
||||
needRender = TRUE
|
||||
if !mapIs3D
|
||||
render()
|
||||
needRender = FALSE
|
||||
else
|
||||
needRender = TRUE
|
||||
fin
|
||||
fin
|
||||
|
||||
// If we're on a new map tile, clear text from script(s) on the old tile.
|
||||
@ -1113,10 +1118,6 @@ end
|
||||
// Get a key, and don't return until it's Y or N (or lower-case of those). Returns 1 for Y.
|
||||
def getYN()
|
||||
byte key
|
||||
if needRender
|
||||
render()
|
||||
needRender = FALSE
|
||||
fin
|
||||
while TRUE
|
||||
key = getUpperKey()
|
||||
if key == 'Y'
|
||||
@ -1294,6 +1295,10 @@ def setCallbacks()
|
||||
// $31B
|
||||
callbacks.27 = $4c
|
||||
callbacks:28 = @clrPortrait
|
||||
|
||||
// $31E
|
||||
callbacks.30 = $4c
|
||||
callbacks:31 = @moveBackward
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user