mbkarle / mind-the-fog

Roguelike JavaScript game--mind the fog!
2 stars 1 forks source link

Interact #87

Closed akarle closed 7 years ago

akarle commented 7 years ago

This branch was entirely to fix #81 .

Basically, I've changed a lot of locations to no longer be passable (such as character dialogues, the dungeon entrance, etc etc).

Then I created a loc_facing variable which will take in the last keystroke of w,a,s,d and spit out the [x,y] coord of the location you are "facing"

From there it was a simple addition to move() to add a condition for the key e, such that pressing e will trigger a checkLocation(loc_facingX, loc_facingY).

A little refactoring done to checkLocation to take in x,y as parameters instead of using avatarX and avatarY, but other than that, a smooth fix / addition that only took about a bit of time.