Page 1 of 1

Kids' exam, summer 2017

Posted: Fri Jul 14, 2017 9:43 am
by richmond62
antMaze.png
This is the exam for the junior programmers . . .

There are 7 green images (food), and the "ant" should consist of a graphic object that can be moved using the arrowKeys
on the keyboard to "collect" the food (and as they are collected they should disappear), and this should be marked in
the "score" field at the top of the window.

This can be sorted out by script in the cardScript alone, using either if . . . then or switch statements.
Ant Maze.livecode.zip
This is the Template stack.
(14.67 KiB) Downloaded 465 times

Re: Kids' exam, summer 2017

Posted: Fri Jul 14, 2017 1:39 pm
by jmburnod
Hi Richmond,
Thanks for summer work
I tried use

Code: Select all

intersect(img "maze.png",img gMyCurAnt,"opaque pixels")
but it return true only when de ant body intersect img "maze.png" but not for one of ant's foot.
(LC indy 8.1.3)
Best regards
Jean-Marc

Re: Kids' exam, summer 2017

Posted: Fri Jul 14, 2017 6:45 pm
by richmond62
Well, jmburnod, as the instructions clearly state that the "ant" should be a graphic object and NOT an image . . .

[ hint: set the backgroundPattern of grc "ant" to the img ID of image "A1.png" ]

Re: Kids' exam, summer 2017

Posted: Fri Jul 14, 2017 6:51 pm
by sturgis
My take on it.

https://www.dropbox.com/s/c40jiwn36lroh ... ecode?dl=0

I too used an image object. oops.

Re: Kids' exam, summer 2017

Posted: Fri Jul 14, 2017 7:03 pm
by richmond62
Here's my NASTY solution (if the 'ant" hits the wall of the maze it goes all the way back
to the start and all its points are lost, and the food items are reset):
Ant Maze END.livecode.zip
(197.22 KiB) Downloaded 462 times