User prompt
Make hero run 5x as fast
User prompt
Only make hero fire bullets if the hero is standing still
User prompt
Make hero able to shoot bullets
User prompt
Set the initial target to the center of the screen
User prompt
Hide the target indicator when the hero reaches the target
User prompt
Make sure the hero has a higher zindex than the target indicator
User prompt
If I drag the mouse while the mouse is pressed the target indicator and move target should move as well
User prompt
Add an indicator to the game that shows where the hero is running to
Initial prompt
Make hero run to where I tap the mouse.
var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = XS.getAsset('hero', 'Hero character', .5, .5); self.addChild(heroGraphics); self.target = { x: self.x, y: self.y }; self.move = function () { var dx = self.target.x - self.x; var dy = self.target.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 1) { self.x += dx / distance; self.y += dy / distance; } }; self.shoot = function () {}; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = XS.getAsset('enemy', 'Enemy character', .5, .5); self.addChild(enemyGraphics); self.move = function () {}; self.shoot = function () {}; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = XS.getAsset('bullet', 'Bullet Graphics', .5, .5); self.addChild(bulletGraphics); self.move = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var hero = self.addChild(new Hero()); hero.x = 2048 / 2; hero.y = 2732 / 2; stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); hero.target.x = pos.x; hero.target.y = pos.y; }); var enemies = []; for (var i = 0; i < 10; i++) { var enemy = self.addChild(new Enemy()); enemy.x = Math.random() * 2048; enemy.y = Math.random() * 2732; enemies.push(enemy); } var bullets = []; XS.on('tick', function () { hero.move(); hero.shoot(); for (var i = 0; i < enemies.length; i++) { enemies[i].move(); enemies[i].shoot(); } for (var i = 0; i < bullets.length; i++) { bullets[i].move(); } }); });
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = XS.getAsset('hero', 'Hero character', .5, .5);
self.addChild(heroGraphics);
self.target = {
x: self.x,
y: self.y
};
self.move = function () {
var dx = self.target.x - self.x;
var dy = self.target.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 1) {
self.x += dx / distance;
self.y += dy / distance;
}
};
self.shoot = function () {};
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = XS.getAsset('enemy', 'Enemy character', .5, .5);
self.addChild(enemyGraphics);
self.move = function () {};
self.shoot = function () {};
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = XS.getAsset('bullet', 'Bullet Graphics', .5, .5);
self.addChild(bulletGraphics);
self.move = function () {};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var hero = self.addChild(new Hero());
hero.x = 2048 / 2;
hero.y = 2732 / 2;
stage.on('down', function (obj) {
var pos = obj.event.getLocalPosition(self);
hero.target.x = pos.x;
hero.target.y = pos.y;
});
var enemies = [];
for (var i = 0; i < 10; i++) {
var enemy = self.addChild(new Enemy());
enemy.x = Math.random() * 2048;
enemy.y = Math.random() * 2732;
enemies.push(enemy);
}
var bullets = [];
XS.on('tick', function () {
hero.move();
hero.shoot();
for (var i = 0; i < enemies.length; i++) {
enemies[i].move();
enemies[i].shoot();
}
for (var i = 0; i < bullets.length; i++) {
bullets[i].move();
}
});
});
Alien organic tank, seen from above, no perspective. Single Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Tank seen from the top Single Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.