Thursday, January 23, 2014

Almost ready to make levels!

Graphics-wise and map-wise, I've implemented locks, keys, upgrav, downgrav, spikes, goal, walls, and spawnpoint. Upgrav and downgrav both work. Locks and keys work to a point -- locks behave like walls until unlocked, and if you get a key, it opens the corresponding lock, which then fades out and ceases to be wall-y. However, "corresponding lock" just means the single square of lock that's in the same place in the 'locks' array as the key is in the 'keys' array. Soon, the arrays should look like this:

keys = [ key0, key1, key2 ]
locks = [ [lockA, lockB, lockC], [lockD, lockE], [lockF, lockG, lockH, lockI] ]

where key0 opens locks[0], i.e. locks A, B, and C. I should be able to assign the key to the lock(s), rather than just having it automatically determined by the order in which they are added to the arrays (i.e. the order in which they are encountered on the map). But I (optimistically) predict that once I've got locks squared away, I'll be able to actually start designing levels! Yaaaay!

Oh, and note to self: maybe I want an indicator on the side telling me what direction my gravity is going?

2 comments:

  1. So, what we talked about yesterday, assigning capital letters to locks and lower case letters to keys in your map format should work well. If you only want one-to-one correspondence from locks to keys, you can just make key "a" open lock "A", etc. If you want multiple keys per lock, or multiple locks per key, you can store a mapping from locks to arrays of keys or keys to arrays of locks using JSON (which can transform javascript values to strings and vice versa easily, using JSON.stringify() and JSON.parse() ). In that case, you'll need figure out some way of indicating to the player what the mapping is (in the case of one-to-one, it's trivial, just color the lock and key the same).

    One-to-one is a bit simpler to implement and you can achieve a multiple key per lock effect by putting locks next to each other. Come to think of it, with the one-to-one scheme you can also achieve multiple keys per lock by having multiple "a"s, and requiring there to be none left on the board to unlock "A".

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete