Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Small, simple request...Promise!

Injury

Awesome Bro

Hey there! I usually like to figure things out for myself, but this is proving tricky, so here it goes!

I'm making a mini-game that requires the hero to collect a certain amount of wood for a fire. I'd like to have a counter of some sort displayed in the corner of the screen while the hero tries to get the wood. The wood could be represented by logs, or just numbers. Beyond that, he would try to collect 5 pieces in enough time to make the fire stay lit. I could really use someone's help in making this system. This is what I have so far. Please let me know if there is anything I can do!

Thanks very much!

Code:
class Window_Wood < Window_Base
  def initialize
    @wood == "1"
    super(0,0,200,200)
    self.contents=Bitmap.new(width-32,height-32)
    self.contents.font.name="Arial"
    refresh
    dispose
  end
  def refresh
    self.contents.clear
    self.contents.draw_text(0,0,200,32,@wood)
  end
  def dispose
    self.contents.dispose #Does not work when I call my_object = Window_Wood.dispose
  end
end

Update: I was working on it a bit, and pulled some stuff from Window_Gold and Window_Base. I can't seem to get the script call my_object = Window_Wood.dispose to work.

I hope I've started this right, I haven't really done this kinda stuff all too often...

Thanks again!
 
This can easily be done with simple eventing. In this explanation, I'm going to assume you know how variables, conditional branches, and switches work. If you don't, go find out in one of the many tutorials on the internet or with a help file :P.
What you'll need is one variable and some pictures of logs (or pictures of numbers 1 through 4).

Start a timer and set it to however long you want the mini-game to last.
Next, start a loop command. In the loop call a conditional branch and set it to check to see if the timer is less than one (ie. zero).
Now, under the case for true, have it do whatever you want to happen if the player does not get all the logs in time and have it end with a break loop command to stop the loop process and then call a stop timer command to stop the timer from continuing.

Next, while still in the loop command and under that last conditional branch, start another conditional branch. In this one, have it check if the variable you selected is 1. Under that case, have it show the picture of a log (or the number 1) wherever on the screen you want it to show.

Do this exact same conditional branch, but do it for the case for if the variable is 2, 3, 4, and 5, changing the picture to show the appropriate number of logs or the right number. But, this time for the 5 case, instead of having it show another picture of 5, have it do whatever the heck you want to happen once the player finishes the mini-game and then have it end the loop with a break loop command and a timer stop command.

Then, after the loop command, you can have the event do whatever you want to happen, whether the player completes or fails the mini-game.

Next, on the map, create your logs and when the player clicks on them, they increase the variable you assigned for this mini-game by 1. Also, make sure that when the player clicks on them, the log disappears (this can be done with switches).

Hope this is what you wanted to do.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top