0 Favourites

# Need some help with game logic for turn based game

• 5 posts
• Hey, I'm trying to make a space puzzle game. This is my first game using this engine. Here's a write up:

In this game the player and computer take turns. The game takes place on a 5x6 grid. The game starts with the CPU. Every CPU turn, 3 enemies will spawn at the top row and existing enemies will move 1 row down. On the players turn, the player can choose as many of the 5 columns to set up their turrets, the player starts with 5, one for each column. Firing a turret takes 1 ammo, the player starts with 5, the turret will fire after the CPU's turn and before the players next turn. After firing, 1 ammo will appear in the column fired at the top row. Turrets can also be used to defend the player against CPU units that will reach the player (last row) on it's turn, upon being destroyed the turret will take 1 turn to be repaired. The turrets are chained to the columns, so a player will not be able to fire down a column if that turret is destroyed. If a player cannot or does not defend themselves their ship will take 1 damage, the player starts with 3 life points. Once a player reaches 0 life points, the game ends. There will be a few different enemies, they will move down the grid differently. The player has to think of the best way to destroy enemies while managing their ammo and turrets. The players high score is based on how many turns a player lasts.

Here is a drawing to better understand: img853.imageshack.us/img853/492/201211042122031.jpg

I haven't implemented everything yet.

But I think I'm missing how some of the logic on conditions and actions work.

Here's the file: dropbox.com/s/bjme7d0krxxrh2p/space%20puzzler%20mock%20up.capx

I will be able to post more on how the functions/groups are supposed to work later tonight if need be.

Any help is much appreciated! I think I might be asking for too much.

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Is there any way to print variables (and arrays) to a textbox or visual field? I believe this would greatly help with finding where the logic is breaking.

I've tried setting a textbox value to the variable. But it just shows up blank. Is this not how to do it or am I printing NULL?

edit: was using text box instead of text. fixed that and found the cast int to string operation. is this a good way to go about debugging?

• Using the Text object is a great way to debug, although you'll generally want to keep tabs on as many variables as possible, so it can get cluttered quickly if you don't organize.

It looks like your game logic is easy to code, so you'll probably get it running by yourself.

• Bleh, don't use text objects. Instead I highly recommend using the chrome console plugin.

• Thanks for the replies!

That chrome console plugin is a sweet piece. Your array addition is great.

Makes it loads easier to see whats going on and what conditions I misinterpreted.

Seems I'm not drawing stuff correctly. I'm putting in some more time figuring it out.

I'll put future troubles in this thread.

Edit: Didn't have a spawn point. Drawing stuff fixed! :)

• 5 posts