+St.Matthew Posted September 24, 2012 Share Posted September 24, 2012 (edited) After publishing my first two Wherigos with help from this forum, I'm hooked. Since my two published Wherigos have been well received, I'd like to try my hand at programming something more complicated than a "lights out" tour. I'm using Urwigo and I thought I'd try to create a board game Wherigo where a trail is the game's board and the Wherigo player is the game-piece. So far, I've got things like dice rolling and turn taking figured out. What I am having trouble with is determining movement in regards to active zones. If there are 25 spaces, and each space is a separate zone, and I want only the space the player is on to be active at a given time, how would I go about doing so? I thought I could create a variable that begins at 0. Each dice roll 1-6 is added to that variable, which then somehow activates the corresponding zone. For example, if the player is on space 4 (out of 25) and rolls a 5, then the variable would calculate 4+5=9. Zone 9 (out of 25) would then activate and the player would have to walk to zone 9. I'm having difficulty conceiving how to do something like this. Is there an easier way than creating a 25 part If/Else? Then again, perhaps there is an easier way. Again, I'm using Urwigo if that helps. Thanks and happy caching! -Matt Edited September 24, 2012 by St.Matthew Quote Link to comment
+sTeamTraen Posted September 25, 2012 Share Posted September 25, 2012 (edited) If you can (i.e., if you are able, and your builder system lets you) write Lua code, you can create an array of zones and then refer to them by an index. For example (syntax may not be exact): allZones = {zoneZone1, zoneZone2, zoneZone3} --etc up to 25 n = 1 --arrays start at 1 -- and then later on... oldn = n n = n + dicenumber allZones[oldn].active = false allZones[n].active = true Edited September 25, 2012 by sTeamTraen Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.