a maze-game stack?
Malte Brill
revolution at derbrill.de
Wed Jul 20 17:41:30 EDT 2005
Hi Nicolas,
if you like to use ArcadeEngine for a pacman like game here is a
out-of-the-top-of-my head approach.
Generate a maze using graphics as walls. each wall a graphic
(style=line).
Store the ID of the graphics in a custom property of the card e.g.
allWalls , each ID on one line. (*)
in a send in time structure you could have the following collision test:
repeat for each line theWall in the allWalls of this card
if intersect(button "myGameHero",grc ID theWall) then
put line 1 of the points of grc ID theWall into startPoint
put line 2 of the points of grc ID theWall into endPoint
put the width of btn "myGameHero" into theRadius
if circleLineSegmentCollide(startPoint,endPoint,the loc of btn
"myGameHero",theRadius)=true then
--collision has happened
else
--no collision has happened
end if
end if
end repeat
This code snippet will check a collisions for all walls you have stored
in the custom property. The fun part is that wall now don´t need to be
right angled anymore, but can use any angle. :-)
If you want to go into detail just let me know. ;-) I´d like to help
writing a nice game again.
Cheers,
Malte
(*)
If you have layed out your maze you could use a repeat loop to set the
cProp
repeat with i=1 to the number of graphics
put the ID of grc i&cr after theList
end repeat
delete char -1 of list
set the allWalls of this card to theList
More information about the use-livecode
mailing list