Author Topic: Constructing games with Construct 2  (Read 6234 times)

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Constructing games with Construct 2
« on: Saturday, July 27, 2013, 12:04:54 AM »
Construct 2 is a neat "game maker" type program, something that lets a person like me with zero coding skills make games. At least that's what it says on the tin. I followed a tutorial and made a crappy little top down shooter which was kinda cool to see the parts come together. It has a bunch of preset kind of objects and variables to set so some things are really easy to put together, like the shooter or a platformer.

Right now I'm trying to work out a very simple game that doesn't have any kind of preset...and i probably shouldn't be doing this at 2am while simultaneously learning the program itself. Anyway, figured it's a pretty simple game to get going so that's what I'm going to work on. It's Cho-Han. Two dice are rolled in a cup, hidden from view. The player places a bet on whether the total of the die faces is even or odd. Dice are revealed, guess right and double your money, guess wrong and you lose your bet. See? Simple.

Now try getting a computer to understand it. I think i just need to dig into the program more to figure out what to do. I need to generate two random numbers between 1 and 6, as opposed to one number 2-12. I figure I can generate the two numbers (Die1 and Die2) and those variables can also be used to choose which die graphic to show as well as do the rest of the calculations. So take the numbers, add them together, check if its even or odd, determine if the player won or lost. Right now I'm trying to figure out how to add the numbers together in the events log. Fun stuff.

So yeah, it's cool. You can get some stuff up and running really quickly which is great for me. Construct exports to HTML5 so I can just drop the final thing on some web space and people can play it. When you get the pay version you can export for desktop or mobile devices and the like. I saw some people recommending it over GameMaker so I figured what the hell, I'll give it a try. Free version has some limitations on the number of events you can have and a couple other missing features but it's enough to learn with. $120 for a personal license if I want to take it further than that. Who knows, maybe I'll be the next great indie dev. Probably not. But maybe.

Offline W7RE

  • Post-aholic
  • *****
  • Posts: 2,780
Re: Constructing games with Construct 2
« Reply #1 on: Saturday, July 27, 2013, 01:11:23 AM »
I was actually just looking at this program and wondering if I wanted to give it a try or not. I read it could be pretty buggy. I then started messing with UDK and decided I didn't want to dive into that so late in the evening (I'm pretty much starting at square one with UDK), and instead starting making pixel art in Photoshop. I didn't like what I had, so I didn't save anything, and now I'm just tired.

EDIT: Actually I wasn't using Photoshop, since I don't have a legit copy of it. I was using (and trying to learn) GIMP, so that was a little frustrating too, since it's the first time I've used it.

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #2 on: Saturday, July 27, 2013, 10:06:58 AM »
Yeah I've been looking at other things like UDK, Unity, and GameMaker. I should probably look into UDK some more but if I'm not making a 3D game then it seems overkill and adding to the complexity because now I need to make 3D models and move them in 3D space.

GameMaker I've messed with before but it seems like you'll run into the free versions limitations pretty quickly, plus every place you want to export to is another $100-200 on top of just the main registration. Unless you buy the Master edition which is $400. I guess thats not so bad if you're to the point of making money off your games.

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #3 on: Saturday, July 27, 2013, 01:22:23 PM »
Generating random numbers is fun! Unless you don't want 8.3592750375 to appear in a dice game, then it gets a little trickier. Also you don't want a zero result. So don't round down, round up! But using rounding there is a smaller range for 1s to show up which throws off the "real" randomness. So I needed to learn about the "floor" function which will always drop down. floor(random(1, 7)) gives me this:

1-2 = 1
2-3 = 2
3-4 = 3
etc.

As you've probably guessed, it goes up to 6-7 and will bring that back down to 6. So there we go, got my random 1 through 6 results! Adding the results of the two dice is also really simple and I even have a text display for it just for testing purposes. I was able to generate all the numbers between 2 and 12 with it and nothing outside that range. Working as intended! Now I need to figure out how to have the game determine if its an even or odd result. Some kind of list would suffice, just have it contain the even numbers. If a match is found then its even, if not then its odd.

But now, a snack.

EDIT: Also it's kind of funny with this program. If I wanted to do something that seems more complex like a platformer it has all these functions built in and ready to go. I could have a platformer up in just a few minutes and then tweak the crap out of it. But something seemingly simple like this has nothing built in so I have to do it all sort of manually...or at least as manually as you have in a game maker.

EDIT2: I searched their forums and looks like someone else was trying to find if a number was even or odd. Turns out there is a pretty simple way of doing it. Hooray!
« Last Edit: Saturday, July 27, 2013, 02:45:39 PM by idolminds »

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #4 on: Saturday, July 27, 2013, 03:45:19 PM »
I think I just optimized my game and I'm freaking out a little. I did...WHAT?

It helps that i figured out how to set sub conditions and actions to things. That basically blew some doors wide open. That should have been in one of their tutorials.

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #5 on: Saturday, July 27, 2013, 10:23:03 PM »
So I've got the game in a pretty workable state. I was going to come up with a way so you can't bet more money than you currently have...but its gambling! If you want to put yourself in debt then I won't stop you! It's also nice because I don't need a game over screen or a way to reset the play field. If you're at -1000 money you could gamble your way back into positive numbers...or go further into debt. Whatever, the choice is yours.

So it is super ugly and just numbers and horrible default system looking buttons. Ick. Now (and by now I mean mostly tomorrow) I'm going to work on making it at least a little prettier. Custom buttons? A...*gasp*....background! MAYBE!

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #6 on: Sunday, July 28, 2013, 10:10:51 PM »
Guess this thread is sort of my dev log.

Spending time making it pretty. I'll probably spend longer making it look good than I spent actually putting it together. I had a bit of fun making the dice graphics work properly. I've got it set as a sprite with each frame of animation each being a side of the die. Then when the die number is determined I've got a function that will set the frame properly.

It seems it wants a straight up number and not any kind of math to determine the frame because for a while I could not get it to work right. The problem was the frame numbers start at 0, and obviously there is no 0 side to dice and thus zero would never be generated. I thought the easiest solution was to then feed it "DieNumber + 1" and it would then choose the correct frame, but for whatever reason it did not like that at all and the die face would change but it seemed to do so randomly. So the next easiest solution was to fill frame zero with nothing and then the frames would be the same number as the side they represent so I could just feed it DieNumber. I also moved setting the frame from when the roll button is clicked to every tick and now its working perfectly.

I also added some cute little tricks like randomly setting the die rotation angle every time they are rolled so they don't look so static.

I've got some Japanese coin graphics from Wikipedia I'm using as the bet buttons. I need to set up some animation for them, just a pop up when mouse over and down when clicked. Shouldn't be too hard. Glad to be getting rid of the ugly-ass buttons. I will be doing the same for the Roll and the actual even/odd choice buttons. Those i think I already know what i'm going to do.

After that I need to have some sort of cover over the dice which will then move out of the way once you have made your choice, to reveal the dice and see if you've won or lost. That should be a fun one and might actually help me with some other tricks. Like I can have it move and then as it collides with another object off screen i can use that as a trigger to Put up a "Win" or "Lose" graphic or something. Then as you click Roll I can have it move back into place, make another collision, which then sets the dice just to make sure they are covered before the numbers pop up. I dunno, just thinking about it.

And then I can see about adding sounds and possibly music! We'll see how many events I have left to use, but I'm only at around 20 events so far so I have plenty of room for that stuff.

Oh yeah, and I am rethinking the unlimited money/bet thing. There isn't a lot of tension when you play. Obviously part of that is I can see the answer, but with the betting the money isn't "worth" anything. Oops, I'm at -1000...I can bid 3000 and if I win I'm back! Bleh. If I limited the bet to how much money you have then you will have to build it up over time, carefully playing. Interesting how a change like that can affect how it feels to play.

Offline Quemaqua

  • 古い塩
  • Administrator
  • Forum god
  • *
  • Posts: 16,498
  • パンダは触るな。
    • Bookruptcy
Re: Constructing games with Construct 2
« Reply #7 on: Monday, August 05, 2013, 09:10:15 PM »
Screenshots or it didn't happen.

天才的な閃きと平均以下のテクニックやな。 課長有野

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #8 on: Monday, August 05, 2013, 09:52:26 PM »
Heh, I'll get back to work on this soon. Ni No Kuni sort of took over.

Offline Quemaqua

  • 古い塩
  • Administrator
  • Forum god
  • *
  • Posts: 16,498
  • パンダは触るな。
    • Bookruptcy
Re: Constructing games with Construct 2
« Reply #9 on: Tuesday, August 06, 2013, 01:52:53 PM »
Haha, good deal. Fun to read about your exploits nonetheless.

天才的な閃きと平均以下のテクニックやな。 課長有野

Offline idolminds

  • ZOMG!
  • Administrator
  • Forum god
  • *
  • Posts: 11,943
Re: Constructing games with Construct 2
« Reply #10 on: Sunday, August 11, 2013, 01:08:25 PM »
Well today I was feeling better after being sick most of the last week, so I decided to see if I could finish this up. I wasn't going to go too fancy but I wanted it in an actual playable state, which means I needed to cover the damn dice. My first choice was to drop a graphic on top and then have it slide out of the way to reveal the dice once the player made their choice, but I couldn't figure out how to set that up. It worked just as well if I simply turned on and off that graphic so...whatever, that's what I did. Finally I had it actually playable! I had to guess and it could be wrong! zomg! Yeah yeah, amazing.

Then it was some other little issues I wanted to clean up. Once you had clicked some coins to set the bet there was no way to reset your bet in case you set it higher than you wanted, so now there is a little X next to the bet amount that will reset it for you. In addition, when you are out of money there was nothing to do. You could keep rolling and guessing but you couldn't place bets. So I had to whip up a quick reset button to replace the roll button when the player was out of money. All it really does is give them the starting money back but it lets you keep going without having to screw with anything in the browser. I also decided to add some WIN and LOSE graphics for a little better feedback as to what was happening as you played.

So, it just finished uploading so if you want to Click Right Here you can play it. Cho Han! Two dice are rolled, their sum is either even or odd. Choose wisely, win money!


Pretty sure I just fixed this and uploaded the new files. Note: I did find a bug in my game which I might as well share. While making the game it sure seemed like making a button invisible essentially disabled that button, but I guess that isn't actually the case. So my current bug is...once the dice are revealed there's nothing stopping the player from adding to the bet and clicking where the invisible winning guess button is. I have some ideas to fix it...I think.
« Last Edit: Sunday, August 11, 2013, 01:29:45 PM by idolminds »