Not a lot to write about today, but I spent a good chunk of time thinking about how to manage the randomizer code I mentioned I was having trouble with. I kind of want this game to feel almost like the Price is Right wheel and have some suspense!
For those of you who don't know, I use Game Maker to do my projects. With my limited time and smaller-scope games/apps, it's really the perfect tool for me and I've been learning very slowly over the last year or so. I'm sure there are a million things I could be doing better, but I'm having a fun time and it's motivating to me to learn as I go. Just takes me longer! In any case, I highly recommend Game Maker for people like me who want to dive right in to making something. You really can learn a lot quickly if you apply yourself.
I wanted to mention that so I can explain my randomization code a bit. As it stands right now, there is a 'test' button that can be pressed to start the sequence (you can see the square on the left side of the image below).
When the button is pressed, I set a global variable to a number within a randomly defined range, and lock-out any additional button presses until the sequence is over so players can't just repeatedly tap for an endless sequence. I use that randomly chosen number to set the time for a hidden countdown timer. Once the number is set initially, the timer counts down to zero then stops.
You can see in the image above, a long, horizontal red box and two blue boxes. The selection of these is what is being randomized. Red is indicating that that is the currently selected box. Here's where the 'suspense' I mentioned comes in.
As the timer counts down, I have another variable that counts up to the maximum of 3 (resetting to 0 as soon as it goes above 3, so it just repeats 0-3 over and over again until the master timer reaches 0). This number defines when a box is highlighted, and counts up at a specific rate. This rate slows down (is a smaller increment per second) depending on how much time is left in the master timer.
For example (not using actual game numbers for simplicity):
if (masterTimer > 50) && (masterTimer < 100)
{
selectionTimer += 1;
}else if (masterTimer >0) && (masterTimer <99)
{
selectionTimer += 0.5;
}
etc...
In short, as the master timer is reduced to within certain ranges, the selector slows it's speed of increase. This gives the effect of the selection highlight slowing down as the master timer gets closer to zero.
I probably explained that horribly, but hopefully it makes at least some sense. In any case, I'm pretty happy with the performance, and it's set up for me to easily tweak numbers to adjust the timing and build a proper game "feel" once I get to that point in development.
Recap:
- Removed old randomizer system - Built a new one that works great!
- Cleaned-up player objects. Didn't mention above, but I also cleaned-up the code in the player objects (the colored rectangles around the edges) to set myself up for the next steps.
Excercise: 1.5 Mile run (also a couple hours of yardwork)
Weight: 222lbs (208 goal)
Calories: 1924

No comments:
Post a Comment