Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find the run loop to be fairly confusing. In step 2 of the tutorial we have

  s1.move(star_zxq.position);
  s1.energize(s1);
  if (s1.energy == s1.energy_capacity) {
    s1.move(base.position)
    s1.energize(base);
  }
What's confusing is that it seems like my sprite should execute all four of these actions. So it's surprising to see that it only does one of these things at a time.

There seem to be at least a couple hidden assumptions:

1. If multiple `move` commands are issued in one loop it will only do the last. Ditto(?) for all other commands

2. A sprite can only be doing on thing at a time. If you order it to do something that it can't do it will simply ignore it. So the `energize` command is simply ignored when it can't energize, and when it can, the `move` command is ignored

While this does help keep the game syntax much more tidy, it's fairly confusing since it doesn't seem to match how a script would normally be read.



The documentation needs work and will cover this.

1. Is correct, whatever is the last command is used

2. This is not true, spirits can move and energize at the same time. But yes, if the object it tries to energize is out of reach (200 units), it will simply ignore the command.


if only the last command is used it should be an error to have more than one. dropping things silently is super confusing.


It seems like there is an implied command buffer, which probably made the implementation much more simple to code and I think makes the scripting language more simple once you get the hang of it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: