skills/hytopia-entities/SKILL.md
Helps create and manage entities in HYTOPIA SDK games. Use when users need to create game objects, NPCs, items, or any interactive objects. Covers Entity class, spawn/despawn, components, animations, and lifecycle management.
npx skillsauth add abstrucked/hytopia-skills hytopia-entitiesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps you create and manage entities in HYTOPIA SDK games.
Documentation: https://dev.hytopia.com/sdk-guides/entities
Use this skill when the user:
import { Entity } from 'hytopia';
class MyEntity extends Entity {
constructor() {
super();
// Initialize entity properties
}
onSpawn() {
// Called when entity is spawned into the world
}
onDespawn() {
// Called when entity is removed from the world
}
tick(deltaTime: number) {
// Called every frame - use for continuous updates
}
}
// Spawn an entity in the world
const entity = new MyEntity();
world.spawnEntity(entity, {
position: { x: 0, y: 10, z: 0 },
rotation: { x: 0, y: 0, z: 0 }
});
// Despawn when done
world.despawnEntity(entity);
import { Entity, Model } from 'hytopia';
class ItemEntity extends Entity {
constructor() {
super();
this.model = new Model({
modelUri: 'models/sword.gltf',
scale: 0.5
});
}
}
import { Entity, PhysicsComponent, HealthComponent } from 'hytopia';
class EnemyEntity extends Entity {
constructor() {
super();
// Add physics
this.addComponent(new PhysicsComponent({
mass: 10,
colliders: [/* collision shapes */]
}));
// Add health
this.addComponent(new HealthComponent({
maxHealth: 100,
currentHealth: 100
}));
}
}
tick(deltaTime: number) {
const player = world.getClosestPlayer(this.position);
if (player) {
const direction = player.position.subtract(this.position).normalize();
this.position.add(direction.multiply(5 * deltaTime));
}
}
class Projectile extends Entity {
velocity: Vector3;
lifetime: number = 5;
tick(deltaTime: number) {
this.position.add(this.velocity.multiply(deltaTime));
this.lifetime -= deltaTime;
if (this.lifetime <= 0) {
world.despawnEntity(this);
}
}
}
onDespawn() - remove event listeners, stop soundstick() sparingly - expensive operations every frame hurt performancesuper() in constructordevelopment
Helps build and manage worlds in HYTOPIA SDK. Use when users need to create terrain, place blocks, manage chunks, or work with the world editor integration. Covers blocks, chunk loading, world generation, and build.hytopia.com workflow.
tools
Helps create and use plugins in HYTOPIA SDK games. Use when users need to add NPM packages, create reusable modules, or extend game functionality. Covers plugin requirements, installation, and best practices.
development
Helps implement physics and collision in HYTOPIA SDK games. Use when users need rigid bodies, collision detection, raycasting, forces, or physics-based gameplay. Covers PhysicsComponent, colliders, raycasting, and physics simulation.
development
Helps save and load persistent data in HYTOPIA SDK games. Use when users need to save player progress, leaderboards, game state, or any data that persists across sessions. Covers PersistenceManager, global data, and player data.