- Szczegóły
- 2440
// Create your own game!
// Spawn a player with spawnPlayerXY()
game.spawnPlayerXY("samurai", 10, 10);
// Add at least one goal!
game.addDefeatGoal(10);
// Create your own game!
// Spawn a player with spawnPlayerXY()
game.spawnPlayerXY("samurai", 10, 10);
// Add at least one goal!
game.addDefeatGoal(10);
// The "defeat" event signals that a unit was defeated.
game.spawnPlayerXY("captain", 40, 35);
game.addSurviveGoal();
game.addCollectGoal(8);
// Use timers to spawn enemies and items.
// This spawns two aggressive munchkins.
function spawnMunchkins() {
var munchkin1 = game.spawnXY("munchkin", 2, 12);
var munchkin2 = game.spawnXY("munchkin", 2, 56);
munchkin1.behavior = "AttacksNearest";
munchkin2.behavior = "AttacksNearest";
}
// This spawns two aggressive throwers.
function spawnThrowers() {
var thrower1 = game.spawnXY("thrower", 2, 16);
var thrower2 = game.spawnXY("thrower", 2, 52);
thrower1.behavior = "AttacksNearest";
thrower2.behavior = "AttacksNearest";
}
// Ogry prą do przodu przez leśne dróżki.
// Przywołaj kilku żołnierzy i spraw by bronili swoich dróżek.
function defendLane(event) {
// Pamiętaj o utworzeniu zmiennych dla celów, by zapamiętać :
var unit = event.target;
// Save the unit's starting pos.x
var startX = unit.pos.x;
while(true) {
var enemy = unit.findNearestEnemy();
// Jeśli jednostka widzi wroga,zaatakuj wroga.
// Move to 'Zsofia' and get the secret number from her.
hero.moveXY(18, 20);
var zso = hero.findNearestFriend().getSecret();
// Divide 'Zsofia's number by 4 to get 'Mihaly's number.
// Move to 'Mihaly' and say his magic number.
var mih = zso / 4;
hero.moveXY(30, 15);
hero.say(mih);
// Idź za śladem monet do czerwonego X przy wyjściu.
while (true) {
// Ta funkcja znajduje najbliższy przedmiot.
var item = hero.findNearestItem();
if (item) {
// Nadchodzi noc! Zgromadź żołnierzy blisko ogniska.
function centerFormation(event) {
// Celem jest każdy żolnierz
var unit = event.target;
// Events have properties like event.target
// This lets you use the same event handler for many different units.
game.addDefeatGoal();
var soldier1 = game.spawnXY("soldier", 50, 30);
var soldier2 = game.spawnXY("soldier", 50, 35);
var soldier3 = game.spawnXY("soldier", 50, 40);
var munchkin1 = game.spawnXY("munchkin", 25, 30);
var munchkin2 = game.spawnXY("munchkin", 25, 35);