Archive

Archive for October, 2010

A small C# helperclass for boardgame-applications: allowable moves

Our students are creating classic boardgames using Silverlight. A problem that kept occurring was the following: “A player throws a certain number with the dice. How do I know, given his current location on the board, to which squares on the board the player is allowed to move to”.

I’ve written a small utility class that can be (re)used for simple applications where you have 2-dimensional map with certain squares on which the player can stand, and other not.
You can download the project here. Feel free to reuse/adapt. I’ve included to demo-usages.

Read more…

Tutorial on Silverlight 4 databinding in code-behind, custom user controls, etc.

10/19/2010 3 comments

Introduction

This small tutorial was written to show the students the following aspects of Silverlight:

  • Writing a class that can be used for databinding
  • Perform data-binding through code instead of XAML
  • Creating a custom user control
  • Writing simple data converters

Suppose we are creating a Silverlight game in which each player is represented as a pawn. However, the player class itself is somewhere deep inside the game-engine and we would like the pawn user control to be only loosely coupled to this player class. By doing this, we are able to make a rapid Silverlight prototype and if we later decide that the frontend is pretty lame, we can simply redesign it without too much fuss.

Read more…

Follow

Get every new post delivered to your Inbox.

Join 208 other followers