Comment

Comment by silvester23

Very nice so far.

I noticed a small problem in the tutorial. On step 3 or 4, when the suggested code is

if (s1.energy == s1.energy_capacity){

memory[s1.id] = "charging";

} else if (s1.energy == 0){

memory[s1.id] = "harvesting";

}

if (memory[s1.id] == "charging"){

s1.move(base.position);

s1.energize(base);

} else if (memory[s1.id] == "harvesting"){

s1.move(star_zxq.position);

s1.energize(s1);

}

My spirit had already transferred a bit of energy to the base, so it entered neither of the states. It was a pretty easy fix to make, but strictly following along the instructions, I would have been stuck there.

parent silvester23 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton