# Newbie - How to create chess game?

Hi there,

I am a newbie who don’t know a thing about scripting… However I want to create a simple board game with no AI. It will be as simple as the player will click on the empty area to make a black seed appear, on the next click it will turns white, then on the next click it will turn empty.

Original board:
+++++
+++++
+++++
+++++

Click once:
+++++
+++++
++B++
+++++

Click again:
+++++
+++++
++W++
+++++

Click again:
+++++
+++++
+++++
+++++

Click click click click…
+++++
++BB+
+BBB+
++B++

Click click …
+++++
++BW+
+BWB+
++B++

Click …
+++++
++BW+
+B+B+
++B++

i hope you can understand from the draft above… Thats mean the game does not need to process all the rules in the game, but the player will play the game with the rules he knows.

all of your +'s would be movieclips. in these movieclips you have 3 frames. +, B and W. The images or whatever is used for +, B and W will all go in their own frame on a single layer (+ on frame 1, B on frame 2 and W on frame 3). Under that layer make a new layer for a button. This button will control the progression of the space through the +, B and W when clicked. This single layer will cover the entire 3 frames and have just that single button. This button should be a square the size of a single playing space. I see you having two options for this button. 1) make it a normal button so that it actually is the the background of the board or 2) make it an invisible button so it doesnt interfere with any of the imagery of the board. To do that, simply edit your button and move the square shape that makes up the button to be only included in the HIT frame.

Now going back to the 3 frame movieclip, put a stop() command on every frame. You can do this in the +,B,W layer since the frames are already broken up there. Then on your button (which takes up the 3 frames) add
on(press){
play()
}
then whenever you hit the button, you’ll play to the next frame and stop. You could have used nextframe() but then at the last frame you would have had to set up something to go back to frame 1. play automatically does this so i figured it was easier this way.

Thats pretty much it. Now you can arrang your board the way you want to using these peices, test it, and see how it works.

try this one: basic chess thingy

And here’s the fla, in case u wanna see it…: [fla-file](http://www.avalon-rev.dk/basic chess.fla)

Has he even read it? :-\

Yes! Thank you very much!

Ah, there he was

hehe…

when linking a geocities swf, include the html and link the html. gc doesnt like off-account file linking.

and for anyone who runs across these gc direct swf links, the easiest way to get around them is to click the link once to pop up the window then click and drag the link into the new window. It will load fine then.

Sweet. Nice work! Very aesthetically pleasing.

Ah… … hehe…

Is anything clickable yet?? (-:

oh no…help!

Actually I am creating this for my pocket pc. However the flash player in pocket pc only support version 5, yet if i export the program to version 5, the click can not work!

What’s wrong?

www.geocities.com/raydream_ework/weiqifla.zip

hold on… I can fix this

my method is flash 5 compatible

AHHH!!!

did u really make all the little blocks manually?? Or… rather… duplicated them??

Hmmmm… I’ll show you how to do it in my other fla, the one I gave u before…

Hang on a few minutes…

Haha…thanks a lot for the last file… but I can’t figure out a way to create layers above the one duplicated by arrays… so I end up copy them one by one…

Hehe, it’s oki, as long as you can figure it out

Well, this version should work in flash 5

see it: [here!](http://www.avalon-rev.dk/basic chess.html)

I just added an invisible button on a seperate layer inside the block MC, and moved the code the that one instead.

Flash 5 doesn’t allow button code on MC’s, flash 6 does… so…

hehe…

Btw u know anything about a flash player for smartphones?? I know the pocketPC player is out tho…

Sorry I don’t know anything about smartphone…

And erm… add a ‘button’ layer below? Does that mean I can just add one in my symbol so that I do not have to duplicate all of them once again?

Hang on…

Here it is!

Dunno why I didn’t just do it on yours right from the start

www.avalon-rev.dk/weiqi.fla

Oh… I follow exactly the same as how you add the button… but there is still some kind of errors show up when I publich:

www.geocities.com/raydream_ework/weiqibutton.zip