Hi there
I’ve read through many tutorials from different sites. However, I still cannot make my tank stop upon hitting obstacles!
I have two obstacles with instance names “obstacle0” and “obstacle1” placed on the stage. I’ve tried the array-method for testing collision among multiple objects but I failed. I typed in the following codes on the first frame:
var obstacles = ["obstacle0","obstacle1"]
//obstacle hit test
numObstacles = obstacles.length
for (i=0;i<numObstacles;i++) {
obstacle = obstacles*
temp = eval(obstacle)
if (temp.hitTest(_root.stnk)) {
_root.stnk.speed = 0
}
}
My script is based on this kirupa tutorial. I wonder if I misinterpreted something as my case is just similar to the case in the tutorial.
Well… i better add the 10.4kb-only file here.
Basic controls
Arrow keys - movement
Spacebar - fire missiles
Q and W - rotate turret and control the direction of fly missiles
Shift - fire deadly laser
A - speed boost (under construction)
S - cloaking device (another problem encountered, in my other thread)
Erm… Forgot to tell you that the grey rotating thing is the service depot where you can reload everything and the green small things on the ground are mines…