a maze-game stack?

Dave Cragg dcragg at lacscentre.co.uk
Wed Jul 20 03:14:34 EDT 2005


On 20 Jul 2005, at 03:19, Nicolas Cueto wrote:

> Hello Malte,
>
> Thanks for replying. And I'll take up your suggestion
> of continuing this on the ArcadeEngine forums.
>
> One more question here, though?
>
>
>> How would you like to create the maze? Randomly
>> (a bit hard) or from a set of template mazes?
>>
>
> Your "a bit hard" is surely "hair-tearing hard" for me,
> so the templates route is likely quicker.
>
> Yet, to follow up on your suggestion of assembling the
> maze out of objects/buttons (like working with Lego?),
> what do you mean by a "template"? A series of co-
> ordinates? A pre-drawn maze?

Example:

You make your "maze area" out of a grid of buttons or rectangles. You  
name the objects in some way so that its coordinates are  
identifiable. For example, the top left button might be "b 1 1", the  
one to the right "b 2 1", the one below that "b 2 2", and so on.

The path throuh the maze is created by setting the backcolor of the  
appropriate buttons white (for example), while the other buttons are  
colored black (for example). A template might conist of a series of  
coordinates like this:

1 1,2 1,2 2,2 3,3 3,4 3,4 3,5 4, ..... etc,

You place the object to be moved (princess, mouse, shoe, whatever) on  
the start square (b 1 1 in this case). Assuming navigation is done  
with the arrow keys, when an arrow key is hit, you calculate the next  
object the person wants to move to. Then check that this is a valid  
place to move to. If so, move the princess, if not, make warning sound.

local sHere  ##tracks the current location

on arrowKey pWhere
   put sHere into tTempHere
   switch pWhere
    case up
       subtract 1 from word 3 of tTempHere
    break
     ## other cases here
   end switch
   if there is a button tTempHere and the backcolor of button  
tTempHere is white then
     put tTempHere into sHere
     set the loc of image "princess" to the loc of button sHere
     ## make cute sound, perhaps
   else
     ##make nasty sound
   end if
end arrowKey

Is this the kind of thing you were thinkig of, Nicolas, or something  
else entirely?

Cheers
Dave





More information about the use-livecode mailing list