<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Mantra.js Gallery Page -get entity</title><script src="https://yantra.gg/mantra.js"></script><script src="https://yantra.gg/worlds.mantra.js"></script></head><body><script>let game =newMANTRA.Game({
graphics:['css'],// array enum, 'babylon', 'css', 'three'});
game.use('Block');
game.use('Border');
game.use('Bullet');
game.start(function(){
game.zoom(1);
game.createBorder();
game.setBackground('#000000');let entity = game.createEntity({
color:0xff0000,
size:{
width:16,
height:16},
hasCollisionStart:true,
position:{
x:0,
y:0}});
game.before('update',function(){// 'entity' reference from earlier is not garanteed to be up to date// Remark: Calling game.getEntity() will fully hydrate all Entity component properties// In most cases you will *not* need to call `game.getEntity()`,let ent = game.getEntity(entity.id);// You can access the same Entity data with game.data.ents._[entity.id]let alsoSameEnt = game.data.ents._[entity.id];
game.setPosition(ent.id,{ x: ent.position.x +0.5, y: ent.position.y +0.5});});</script></body></html>