Chess help

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • So im programming a two player Chess game as my first Construct 2 game as practice, and im wondering this:

    So if I select a Rook on, say, e4, I want the squares e5, e6, e7, e8, d4, c4, b4, a4, e3, e2, e1, f4, g4, and h4 to light up. I already have objects with selection animations on each of the squares for tiles, but how in the world would I program this for every piece's specific movements on every spot on the board? Is there some way to group the logic into a single algorithm applied to the given piece?

  • Anyone?

  • ... No one?

  • Yes, there is way. But to help you, it's important to know how you handle your game logic.

  • What do you mean?

  • How do you represent your game state for instance. Do you use an array ?

  • Yeah I have an 8x8x2 Array for the board... It's all very confusing...

    Half the array stores whether the square is blank, has white piece, or has black piece. The other half has a value 3-35, where 3 is an empty square and 4-35 are individual pieces.

    I'm extremely inexperienced. Is this the correct way to do it? And if I use an array, how do I do my original question?

  • You could do the same with a 8x8 2D array, and a wider range of values for the different pieces. I wonder, why the 4-35 range for your pieces ? You could also store piece values as strings, like "BK" for "black king" or "WQ" for "white queen". Doesn't change anything but makes your events easier to read ! ;)

    Basically, you'll have to create one set of event for each different kind of piece. You could do it with a function that receive 3 parameters : xPos, yPos and pieceType. Depending on the pieceType and the positions, you highlight the tiles that can be moved on.

    How familiar are you with functions and array manipulation ?

  • I WANT to say I'm familiar... but... no haha...

    If you don't want to explain what is necessary, is there something in the manual/a tutorial that explains it? I don't want to waste your time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Look at the plugin's forum and look at rexrainbow's plugin for doing Chess type logic: Plugin Board, Layout2Board Behavior Grid Move

  • Stupid question: How to install plugin to Construct 2 when I have it through Steam? I've searched this website, the methods I saw give the path if you downloaded it outside of Steam before it came out on Steam.

  • Anyone know?

  • Where are your Steam Apps installed ? If you left it by default it should be something like "C:\Program Files\Steam\SteamApps\". Construct is probably somewhere in there. Just copy the plugin folder in the "exporters\html5\plugins" folder (or "exporters\html5\behaviors", for behaviors <img src="smileys/smiley2.gif" border="0" align="middle" />)

  • I've done exactly that: created folders for each, put file in them, under Construct2-Win32 Plugins and Behaviors, and I've made sure I put plugins in Plugins and behaviors in Behaviors. But I get this error report for each of the five plugins/behaviors:

    Unable to load plugin in C:\ProgramFiles\Steam\steamapps\Common\Construct2\Construct2-Win32\exporters\html5\plugins\New Folder

    Cannot open file <insert what I typed above>... \New Folder\common.js

    This plugin will not be available in the editor.

  • Anyone?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)