Since finding out a very clever way to reduce the size of the snake within the 'snake' activity, I've been buzzing with ideas of what to do with it.
This was my first attempt at creating a game that allows you to collect items that make your snake grow in length.
The green play button code contains;
var seg:Number=6; _root.hitDist=40; _root.dxy=4;
There is a sun element that also contains code;
for(n=(_root.seg);n<=20;n++) { ob=eval('_root.p' add n); ob._x=-20; };
The children to be collected are actually 'monster' elements, with the collision setting set to advanced code. You'll notice that when the 'leader' moves over a child, the score increases by 1. This was achieved by adding the following code to each child;
_root.sc+=1; _root.seg =_root.seg+1; this._visible=0; this._x=root.player._x; this._y=root.player._y;
However, this was problematic because the first child initiated the score, then the second child made the score 1, the 3rd was 2, etc. To correct this, there was a monster element placed below the starting point of the 'head' with the following code;
_root.sc+=1;
this._visible=0;
This began the scoring, and hid the element once it had been run over.
It all worked well, apart from the large gap between the last segment, and the new addition. This is something I am still trying to sort out.
However, in the meantime, Dan at 2Simple has been thinking how to solve this problem and come up with 3 great alternatives;
Download Dan snake 1 (.2iy file)
Download Dan snake 2 (.2iy file)
Download Dan snake 3 (.2iy file)
Based on the third example, the pied piper activity has been built.


Recent Comments