David87
02-19-2008, 08:23 PM
Im creating a flash game which is a side scroller and has a submarine underwater which is controlled using the arrow keys underwater.
The aim of the game is for the submarine to pick up objects under the water by colliding with them (hitTest).
My question is i dont know what the code would be which would allow me to control the submarine so that when i hit one of the objects in the water with the submarine it would recognize it as a hitTest and the object would then be removed from the stage or movie
I know the basic hitTest code to create a object which is detected through collision, but i cant figure out how to implement this basic hitTest code for my submarine in my game so that it can be controlled with the keyboard keys and then recognises a hit detection when it moves over a object?
If someone could help me that wud be gr8
Thx
EDIT**
My current code i have is this
onEnterFrame = function():Void
{
if (Key.isDown(Key.RIGHT)) && (_root.submarine, hitTest(_root.creature))
{
_root.text = "Collision Detected";
}
}
where submarine is the main object which can be moved using the keyboard keys and creature is the object which i want the submarine to perform the hitTest on
The aim of the game is for the submarine to pick up objects under the water by colliding with them (hitTest).
My question is i dont know what the code would be which would allow me to control the submarine so that when i hit one of the objects in the water with the submarine it would recognize it as a hitTest and the object would then be removed from the stage or movie
I know the basic hitTest code to create a object which is detected through collision, but i cant figure out how to implement this basic hitTest code for my submarine in my game so that it can be controlled with the keyboard keys and then recognises a hit detection when it moves over a object?
If someone could help me that wud be gr8
Thx
EDIT**
My current code i have is this
onEnterFrame = function():Void
{
if (Key.isDown(Key.RIGHT)) && (_root.submarine, hitTest(_root.creature))
{
_root.text = "Collision Detected";
}
}
where submarine is the main object which can be moved using the keyboard keys and creature is the object which i want the submarine to perform the hitTest on