Create Bullet

From LuaSTG Wiki
Jump to navigation Jump to search

A create bullet node creates a bullet of a custom bullet type previously defined by the user. The bullet type should be defined with Define Bullet node.


Parameters[edit | edit source]

Here is a list of parameters of create bullet node.

Parameters Function
Name (string) The name of the bullet type that this bullet belongs to
Position (number, number) The initial position of the bullet on creation
Parameters (value list) A list of values assigned to each parameter in the parameter list, adjacent values are separated by comma. The parameter list is given by the one in the define bullet node


Initial Position[edit | edit source]

Be aware that the initial Position of bullet spawn is specified here in the create bullet node, instead of as a parameter of the define bullet node.

This makes it impossible to directly set the values of .x and .y by the parameters in the parameter list of the bullet type, since the parameters are provided to the bullet (in define bullet node) later than the time initial position is set (in create bullet node).

A workaround to this problem is to leave dummy values in the Position parameter, and set self.x and self.y in on init of the define bullet node, where we have access to the parameters of the bullet type.