Direct from Dan at 2Simple;
You can add code which will take effect when a monster collides with the player. You can, however, use the code below to add collision code between any 2 objects of your choice. For example, drag the top sun to the canvas and add the following to the animation code of any object :
if (_root.distBetween(_root.player,_root.s22) < _root.hitDist) { _root.player._xscale ++; _root.player._yscale ++; }
This means that whenever the player collides with the top sun, the player will increase in size. The function "distbetween" calculates the distance between the 2 objects that it is given. "hitDist" is one of the variables defined in the initial section of your code and defaults to 40.
You could add collision code which checks for collisions against multiple objects - for example
for (n=22; n<=31; n++) {
ob = eval('_root.s' add n);
if (_root.distBetween(_root.player,ob) < _root.hitDist) { _root.player._xscale ++; _root.player._yscale ++; }
};
The above code checks whether the player has collided with any of the suns.
- Note - change "player" to "car" for the journey game.
- Note - for Collecting and Journey the top sun is s22. For Maze, Platform and Snake the top sun is s23.


Recent Comments