Block (TeaScript)

From Moondust Wiki
Jump to navigation Jump to search

Block is a class in TeaScript.vbs that allows you to read/write values for blocks.

To read the value of Block use:

Block(id).name

id stands for the block's permanent ID. To change the value of Block use:

Block(id).name = value

Block Properties

Physical Properties
Type Name Read/Write Description
double id - The ID is used to decide and tie in its graphics, behavior, and behaviour flags. You can change this value to change the block into another
double permid Read Only A special number that can be used to uniquely identify the block. No two blocks will have the same permID.
double x - The x coordinate of the NPC in scene coordinates.
double y - The y coordinate of the NPC in scene coordinates.
double width - The width of the block's hitbox.
double height - The height of the block's hitbox.
double xsp - The horizontal speed of the block. Negative values cause leftwards movement, positive values cause rightwards movement.
double ysp - The vertical speed of the NPC. Negative values cause upwards movement, positive values cause downwards movement.
double state - The current state of the block. Setting this to 1 will hit the block; anything else will break it.
Notice Note: Breaking the block, whether through normal means or by code, does not affect the hide variable.
double hide - Whether the block is hidden or not.
Notice Note: This does not function the same way as destroying blocks.
double pcollision Read Only The type of collision a player will have with the block, determined by block settings.
double ncollision Read Only The type of collision an NPC will have with the block, determined by block settings.
Behaviour Properties
Type Name Read/Write Description
double haswing - A set of values pertaining to what kind of wings the block has.
  • If set to 0, the block will have no wings and behave like normal.
  • If set to 1, the block will hover left and right.
  • If set to 2, the block will hover up and down.
  • If set to 3, the block will hover forward.
  • If set to 4, the block will be controlled by NPC 308.
  • If set to 5, the block will be controlled by SMW Line BGOs.

Archive

Name Type Description
x R&W The X coordinate of the block.
y R&W The Y coordinate of the block.
xsp R&W The X-speed of the block.
ysp R&W The Y-speed of the block.
id R&W The current block number.
state R&W If set to 1, it will hit the block. Any other value will break it.
hide R&W Stands for whenever the block is hidden or not. (If the layer of the block is hidden, it turns 1)
advset R&W The contents of the block.

0 = Empty

1 to 99 = Contains however many coins the value is set to. (i.e. 15 will contain 15 coins)

-302 = Multiple coins (hasn't been hit yet)

-301 = Multiple coins (has been hit)

1xxx = NPC ID contained in the block. (i.e. 1031 contains a Key, which is NPC ID 31.)

pcollision R The player collision type of the block.
ncollision R The NPC collision type of the block.
forecolor R&W The color of the block. Uses rgba.
haswing R&W Determines if the Block has the wing special type and what type of wing movement it has.

0 = None

1 = Hover Left/Right

2 = Hover Up/Down

3 = Hover Forward

4 = Controlled by NPC-308

5 = SMW Lines

ExtX R&W The X placement of the GFX expansion.
ExtY R&W The Y placement of the GFX expansion.
Width R&W Stands for the block width.
Height R&W Stands for the block height
Onscreenevent R&W Stands for the Block on screen event.
Hitevent R&W Stands for the Block Hit event..
forecolor_r R&W The red channel of the Block's forecolor.
forecolor_g R&W The green channel of the Block's forecolor.
forecolor_b R&W The blue channel of the Block's forecolor.
forecolor_a R&W The alpha/transparency channel of the Block's forecolor.