Home Reference Source Repository
import {Sprite} from 'webgame-lib/src/drawable.js'
public class | source

Sprite

Extends:

Drawable → Sprite

Image.

Constructor Summary

Public Constructor
public

constructor(img: Image)

Initializes.

Member Summary

Public Members
public

img: *

public

pos: *

Method Summary

Public Methods
public

bounds(rect: *)

public

draw(ctx: *, x: *, y: *)

Inherited Summary

From class Drawable
public

bounds(rect: Rect)

Set the rectangular bounds of the section to draw.

public

Draws at given position.

Public Constructors

public constructor(img: Image) source

Initializes.

Params:

NameTypeAttributeDescription
img Image

Image to draw

Public Members

public img: * source

public pos: * source

Public Methods

public bounds(rect: *) source

Override:

Drawable#bounds

Params:

NameTypeAttributeDescription
rect *

public draw(ctx: *, x: *, y: *) source

Override:

Drawable#draw

Params:

NameTypeAttributeDescription
ctx *
x *
y *