Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Help with Skeletons in Tabula Rasa Javascript

I’m on Tabula Rasa in game development one. I have a lightstone in my game, but when I pick up the lightstone and approach a skeleton, the skeleton still attacks me. Also, the lighstone doesn’t disappear after I’ve held it for a while. Do I need to do something special to get the lightstone to function as a skeleton repellant? I don’t have any specific error lines in my code, but here it is so far:

var player = game.spawnPlayerXY('captain', 8, 8);

game.addCollectGoal(4);
game.addSurviveGoal();

game.spawnXY("forest", 8, 18);
game.spawnXY("forest", 25, 8);
game.spawnXY("forest", 8, 38);
game.spawnXY("forest", 25, 30);
game.spawnXY("forest", 16, 38);
game.spawnXY("forest", 43, 8);
game.spawnXY("forest", 43, 25);
game.spawnXY("forest", 43, 29);
game.spawnXY("forest", 43, 17);
game.spawnXY("forest", 43, 47);
game.spawnXY("forest", 52, 47);
game.spawnXY("forest", 60, 47);
game.spawnXY("forest", 60, 38);
game.spawnXY("forest", 60, 30);
game.spawnXY("forest", 60, 22);
game.spawnXY("forest", 60, 16);
game.spawnXY("forest", 43, 55);
game.spawnXY("forest", 43, 61);
game.spawnXY("forest", 25, 46);
game.spawnXY("forest", 25, 13);
game.spawnXY("forest", 25, 50);

game.spawnXY("fire-trap", 18, 53);
game.spawnXY("fire-trap", 14, 53);

game.spawnXY("gem", 34, 6);
game.spawnXY("gem", 6, 27);
game.spawnXY("gem", 22, 36);
game.spawnXY("chest", 51, 57);

game.spawnXY("thrower", 15, 47);
game.spawnXY("munchkin", 9, 26);
game.spawnXY("munchkin", 25, 36);
game.spawnXY("munchkin", 34, 9);
game.spawnXY("munchkin", 55, 58);
game.spawnXY("munchkin", 56, 54);
game.spawnXY("skeleton", 52, 22);

game.spawnXY("potion-small", 52, 35);
game.spawnXY("lightstone", 18, 47);

player.maxSpeed = 30;
player.attackDamage = 6;
player.maxHealth = 30;

Hi Redpanda ad welcome to the forum!

While I don’t have an answer for you, I wanted to let you know that someone had looked at it. To test, I moved the stone’s spawn point closer to the skeleton (it expired too quickly with your original code…yes, I’m a slow clicker), disabled the nearest ogres and gave it a go…yes, in spite of having just picked up the stone, the skeleton charged the hero and killed him. I’ll play around with it a bit, but am hoping someone more experienced with game devs will be able to assist.

If you are still around, I think this might help:

var skel = game.spawnXY("skeleton", 52, 22);
skel.behavior = "FearsTheLight";

When I tested with this with your code, the skeleton did run away.

Thank you so much! I added those changes and it worked perfectly. Much appreciated.

1 Like