Thursday, November 26, 2009

FileMaker Snake game - a FM 10 Demonstration



When I first started looking at FM10's new functions (Trigger, timer, etc), I wanted to create a demo, in which I can implement almost all of these new features.

I was currently also looking at my old floppy disks, and found my snake game I wrote in Turbo Pascal when I was a small kid, and thought why not recreate it in FileMaker?

It could demonstrate layout triggers (OnLayoutKeyStroke), Timers (speed of the game)
.

Heres is what I came up with:



The main layout is a repeating field container (300 repetitions actually), arranged.
The repeating field uses a global variable and conditional formatting to show the snake and the treasure (which is set by a custom function based on it's current repetition number).
Two colors are used, Green and White:


The Snake and Treasure positions are stored in global variables as a list (eg.: 10,12 11,12, etc), and are processed by the script.

The script names of the demo file shows what they do exactly, you could easily figure them out.

The layout has a script trigger, which is to check for keyboard input, so we can move the snake.

This is a FM10 demo, which you can download from here . (right click- save as)

Note1: I did't spend too much time on optimizing this, making it prettier, etc, it's up to you. This is just a demo file, to demonstrate some of FileMaker 10's new features.

Note2: Please also visit our site, http://crm.fm which has our main FileMaker product, and support us by buying it. Thanks!

The material on this document is offered as is. There is no representation or warranty, expressed or implied, nor does any other contributor to this post. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

1 comment:

  1. Hey
    Here is a hint for you :) Replace all refresh script steps with a freeze script step. This will rid your nice demo of the screen flickers.

    thanks ...take care.

    ReplyDelete