Shot Object Functions

From Danmakufu Wiki
Jump to: navigation, search

ObjShot_Create

Parameters:
 1) object type (constant)

Creates a Shot object and returns its ID. Object types are:

  • OBJ_SHOT: generic bullet
  • OBJ_LOOSE_LASER: loose laser
  • OBJ_STRAIGHT_LASER: straight laser
  • OBJ_CURVE_LASER: curved laser

In order to draw and fire the shot object and have it listed as an existing bullet, you have to register it using ObjShot_Regist.

ObjShot_Regist

Parameters:
 1) object ID (real)

Activates the shot object, which will now be fired.

ObjShot_SetAutoDelete

Parameters:
 1) object ID (real)
 2) auto-delete (bool)

Enables or disables auto-deletion of the shot object when outside of the screen boundaries. Defaults to true.

ObjShot_FadeDelete

Parameters:
 1) object ID (real)

Fades out the shot object and deletes it.

ObjShot_SetDeleteFrame

Parameters:
 1) object ID (real)
 2) frames (real)

Deletes the shot object after the specified number of frames.

ObjShot_SetDelay

Parameters:
 1) object ID (real)
 2) frames (real)

Delays the shot object, firing it after the specified number of frames. Bullets will glow to announce delay; lasers will be shown very thin.

ObjShot_SetSpellResist

Parameters:
 1) object ID (real)
 2) spell resist (bool)

When set to true, the shot object will not be deleted by the player's bomb. Defaults to false.

ObjShot_SetGraphic

Parameters:
 1) object ID (real)
 2) graphic ID (real)

Gives the shot object the specified graphic. The list of default graphics can be found here.

ObjShot_SetSourceBlendType

Parameters:
 1) object ID (real)
 2) blend type (constant)

Gives the shot object's delay graphic the specified blend type. Options are:

  • BLEND_ALPHA: Alpha blend
  • BLEND_ADD_RGB: Additive blend
  • BLEND_ADD_ARGB: Additive blend with alpha channel
  • BLEND_MULTIPLY: Multiplicative blend
  • BLEND_SUBTRACT: Subtractive blend
  • BLEND_INV_DESTRGB: Inverting blend

ObjShot_SetDamage

Parameters:
 1) object ID (real)
 2) damage (real)

Sets the damage of the specified shot object. For player shots only.

ObjShot_SetPenetration

Parameters:
 1) object ID (real)
 2) bullet penetration (real)

Sets the penetration of the shot object. The shot object can hit enemies as many times as the penetration value before being deleted. For player shots only.

ObjShot_SetEraseShot

Parameters:
 1) object ID (real)
 2) erase (bool)

Enables/disables the ability to erase enemy shots when the specified shot object comes into contact with it. Each time a shot is erased, the penetration of the shot object will go down by 1. For player shots only.

ObjShot_SetSpellFactor

Parameters:
 1) object ID (real)
 2) enable (bool)

Sets whether or not to use the spell damage factor for the shot object. For player shots only.

ObjShot_ToItem

Parameters:
 1) object ID (real)

Turns the bullet into an item.

ObjShot_AddShotA1

Parameters:
 1) source object ID (real)
 2) object ID of shot object to add (real)
 3) frame on which to activate added shot (real)

At the specified frame, spawns the added shot object at the source shot object's position.

ObjShot_AddShotA2

Parameters:
 1) source object ID (real)
 2) object ID of shot object to add (real)
 3) frame on which to activate added shot (real)
 4) distance to source shot object (real)
 5) angle to source shot object (real)

At the specified frame, spawns the added shot object at the specified distance and angle from the source shot object's position.

ObjShot_SetIntersectionCircleA1

Parameters:
 1) object ID (real)
 2) hitbox radius (real)

Creates a hitbox of specified radius for collision detection of the shot object. In order to maintain the hitbox, it must be set every frame. There can be multiple hitboxes set for one shot object.

ObjShot_SetIntersectionCircleA2

Parameters:
 1) object ID (real)
 2) x-coordinate of the center of the hitbox (real)
 3) Y-coordinate of the center of the hitbox (real)
 4) hitbox radius (real)

Creates a hitbox of specified radius for collision detection of the shot object. In order to maintain the hitbox, it must be set every frame. There can be multiple hitboxes set for one shot object.

ObjShot_SetIntersectionLine

Parameters:
 1) object ID (real)
 2) start x-coordinate (real)
 3) start y-coordinate (real)
 4) end x-coordinate (real)
 5) end y-coordinate (real)
 6) hitbox line width (real)

Creates a line segment hitbox between the specified coordinates for collision detection of the shot object. In order to maintain the hitbox, it must be set every frame. There can be multiple hitboxes set for one shot object.

ObjShot_SetIntersectionEnable

Parameters:
 1) object ID (real)
 2) collision detection (bool)

Sets whether collision detection of the shot object will be checked. If set to false, the shot object will have no collision detection.

ObjShot_SetItemChange

Parameters:
 1) object ID (real)
 2) enable (bool

Sets whether the shot object will turn into an item when deleted. If set to false, the shot object will not turn into an item.

ObjShot_IsSpellResist

Parameters:
 1) object ID (real)

Returns whether the shot object can be deleted by a player bomb. Shot object bomb resistance can be set with ObjShot_SetSpellResist.

ObjShot_GetImageID

Parameters:
 1) object ID (real)

Returns the graphic ID of the shot object.

ObjShot_GetDelay

Parameters:
 1) object ID (real)

Returns the shot's remaining delay frames.

ObjLaser_SetLength

Parameters:
 1) object ID (real)
 2) laser length (real)

Sets the length of the laser object.

ObjLaser_SetRenderWidth

Parameters:
 1) object ID (real)
 2) render width (real)

Sets the visible width of the laser object (not the same as the laser object's collision width).

ObjLaser_SetIntersectionWidth

Parameters:
 1) object ID (real)
 2) collision width (real)

Sets the collision width of the laser object. This can be set to be larger than the laser object's render width, so take caution.

ObjLaser_SetGrazeInvalidFrame

Parameters:
 1) object ID (real)
 2) invalid graze frames (real)

Specify the number of frames after a graze where graze is not counted. If you specify 0, the laser object can be grazed only once. The default value is 20 frames (3 graze/second).

ObjLaser_SetInvalidLength

Parameters:
 1) object ID (real)
 2) ratio removed from the laser base (real)
 3) ratio removed from the laser tip (real)

Sets the portion of the laser object where there is no collision, in relation to the base and the tip of the laser. By default, the values are 10 (10%).

ObjLaser_GetLength

Parameters:
 1) object ID (real)

Returns the length of the laser object.

ObjStLaser_SetAngle

Parameters:
 1) object ID (real)
 2) angle (real)

Sets the angle at which the straight laser object will point at (different from movement angle).

ObjStLaser_GetAngle

Parameters:
 1) object ID (real)

Returns the angle at which the straight laser object is pointing (different from movement angle).

ObjStLaser_SetSource

Parameters:
 1) object ID (real)
 2) draw laser source (bool)

Sets whether the light source at the base of the straight laser object is drawn.

ObjCrLaser_SetTipDecrement

Parameters:
 1) object ID (real)
 2) tip transparency reduction rate (0.0-1.0) (real) 

Sets the transparency reduction rate at the tip of the curved laser object. Default is 1.0 (tip of laser is invisible).