Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/caviar/mod.ts>Entity

⚡ Blazing fast, modern, Game Engine powered by WebGPU for Deno and the browser
Latest
class Entity
Abstract
import { Entity } from "https://deno.land/x/caviar@2.6.9/mod.ts";

An Entity represents any object that can be used in a scene

Constructors

new
Entity(x: number, y: number)

Properties

height: number

Height of the entity

readonly
id

Identifier for the entity

readonly
interactive

Whether or not the entity is interactive

width: number

Width of the entity

x: number

X coordinate of the entity

y: number

Y coordinate of the entity

z: number

Z coordinate of the entity

Methods

collides(_x: number, _y: number)

Logic for determining mouse collision

Runs when the entity is clicked

setInteractive(interactive?)

Sets the interactivity to a boolean

setPosition(
x: number,
y: number,
z?: number,
)

Sets the entities position