Shot Functions

From Danmakufu Wiki
Jump to: navigation, search

DeleteShotAll

Arguments:
    1) type
         TYPE_ALL
         TYPE_SHOT
         TYPE_CHILD
    2) delete type
         TYPE_IMMEDIATE
         TYPE_FADE
         TYPE_ITEM

Deletes all shot objects on screen matching the criteria. TYPE_ALL will clear all shot objects, TYPE_SHOT will clear only shot objects without spell resistance, and TYPE_CHILD will clear shot objects fired from the currently running script (e.g. a stage script that spawns enemies, putting CHILD in one of the enemy's script will clear only that enemy's bullets). The second type determines how the bullet will be deleted. TYPE_IMMEDIATE will immediately delete the bullets, TYPE_FADE will slowly fade out the bullets (note, they will still be visible while fading out, but they will not have any collision), and TYPE_ITEM will turn the bullets into items according to the running item script.

DeleteShotInCircle

Arguments:
    1) type
    2) delete type
    3) x-coordinate
    4) y-coordinate
    5) radius

Same as DeleteShotAll, except it will only clear bullets in a defined circle.


CreateShotA1

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) speed
    4) angle
    5) graphic
    6) delay
Returns:
    Object ID

Creates a basic bullet that will move in the angle and speed defined. Graphic is the image the bullet will have, while delay is the time in frames that the bullet will appear. During it's delay, there will be a cloud that appears where the bullet will spawn.

Refer to this bullet list for built in bullet id names.

Also note that CreateShot functions will return a void value in a player script if the player is unable to shoot.


CreateShotA2

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) speed
    4) angle
    5) acceleration
    6) max speed
    7) graphic
    8) delay
Returns:
    Object ID

Same as CreateShotA1, except you can define an acceleration and max speed for the bullet. The number defined for acceleration will be applied to the bullet per frame, so this will usually have low numbers such as 0.1. Negative values may be used, however, having a negative value on acceleration but a positive number on max speed (or vice versa) will result in the bullet spawning at max speed.


CreateShotOA1

Arguments:
    1) Object ID
    2) speed
    3) angle
    4) graphic
    5) delay
Returns:
    Object ID

Creates a bullet that will spawn on the coordinates of the given object id. The bullet and its arguments act the same as CreateShotA1.


CreateShotB1

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) x speed
    4) y speed
    5) graphic
    6) delay
Returns:
    Object ID

Same as CreateShotA1, except you can define separate x and y speeds for the bullet.


CreateShotB2

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) x speed
    4) y speed
    5) x acceleration
    6) y acceleration
    7) x max/min speed
    8) y max/min speed
    9) graphic
    10) delay
Returns:
    Object ID

Same as CreateShotB1, except you can define separate x and y accelerations, and corresponding max/min speeds.


CreateShotOB1

Arguments:
    1) Object ID
    2) x speed
    3) y speed
    4) graphic
    5) delay
Returns:
    Object ID

Creates a bullet that will spawn on the coordinates of the given object id. The bullet and its arguments act the same as CreateShotB1.


CreateLooseLaserA1

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) speed
    4) angle
    5) length
    6) width
    7) graphic
    8) delay
Return Value
    Object ID

Creates a laser that functions much like a bullet from CreateShotA1, but can be defined with a size. This could also be used to create larger bullets.


CreateStraightLaserA1

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) angle
    4) length
    5) width
    6) delete time
    7) graphic
    8) delay
Return Value
    Object ID

Creates a laser mounted on a position. The 'delete time' argument determines how many frames until the laser disappears. Delay will spawn a very thin laser that has no collision in order to give the player a warning.

Having no delay while using this laser is not advisable, as they spawn at full size the moment the delay is over.


CreateCurveLaserA1

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) speed
    4) angle
    5) length
    6) width
    7) graphic
    8) delay
Return Value
    Object ID

Creates a laser that functions similarly to CreateLooseLaserA1, but can be altered with ObjMove_SetAngularVelocity to create a curving laser.

This function is heavy to process, so having many of them on-screen is not recommended.


SetShotIntersectionCircle

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) radius

Creates the specified circle that will check for collisions.

The player dies when touching/entering the circle.


SetShotIntersectionLine

Arguments:
    1) start point x-coordinate
    2) start point y-coordinate
    3) end point x-coordinate
    4) end point y-coordinate
    5) width

Creates the specified line that will check for collisions.

The player dies when touching the line.


GetShotIdInCircleA1

Arguments:
    1) x-coordinate
    2) y-coordinate
    3) radius
Returns:
    Array

Returns the object IDs of the bullets inside the given circle in an array.

Inside the player script, it will only return enemy bullet IDs, and vice versa.


GetShotIdInCircleA2

Arguments:
    1) x-coordinate 
    2) y-coordinate 
    3) radius 
    4) target 
Returns:
    Array

Returns the IDs of the bullets inside the given circle and corresponding to the target in an array.

The target can be:

  • TARGET_ALL
  • TARGET_ENEMY
  • TARGET_PLAYER


GetShotCount

Arguments:
    1) target
Returns:
    Integer

Returns the number of bullets that exist from the given target.

The target can be:

  • TARGET_ALL
  • TARGET_ENEMY
  • TARGET_PLAYER


SetShotAutoDeleteClip

Arguments:
    1) left boundary (default 64)
    2) top boundary (default 64)
    3) right boundary (default 64)
    4) bottom boundary (default 64)

Sets at what point the bullet will be automatically deleted when leaving the STG screen.

To override this auto deletion, use ObjShot_SetAutoDelete on the bullet you want to prevent from auto deleting.

GetShotDataInfoA1

Arguments:
    1) graphic id
    2) target
        TARGET_PLAYER
        TARGET_ENEMY
    3) info type
        INFO_RECT             : Coordinate rect list.
                                Returns real array: [left, top, right, bottom]
        INFO_DELAY_COLOR      : Delay color RGB list.
                                Returns real array: [red, green, blue]
        INFO_BLEND            : Blending type.
                                Returns real. can be BLEND_ALPHA, BLEND_ADD_RGB, or BLEND_ADD_ARGB
        INFO_COLLISION        : Radius of collision detection.
                                Returns real
        INFO_COLLISION_LIST   : List of collision hitbox radii and coordinates.
                                Returns real two-dimensional array: [radius, x, y]
Return Value
    value array based on info type

Returns information depending on the information requested.

StartShotScript

Arguments:
    1) script path

Starts a shot script.