aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

Implement protection against fatality #338

Closed aroberge closed 7 years ago

aroberge commented 7 years ago

Instead of simply having tile properties like:

tile.fatal = true

we should have instead:

tile.fatal = "name"

and implement something like

RUR.add_protection(name)
RUR.remove_protection(name)

When moving (teleporting included) onto a fatal tile, we should check to see if there is protection against it.

aroberge commented 7 years ago

The .fatal attribute is set correctly; just need to implement protection.

aroberge commented 7 years ago

Implemented by checking properties of carried objects. Basically, instead of protecting the robot, we have objects (like "bridge") that protects against some fatalities ("mud" and "water" for "bridge"). If these objects are either carried by Reeborg or used as bridges, they can offer protection.