Topic: Game Programming / How do you do?
Hey there,
I know Rete said he doesn’t know programming, but I’m the programmer for his games so maybe I can give some quick tips. I should start by saying I code in AS3 using Flash Develop, so if you use AS2 or the Flash IDE, my technique might not be very helpful. Also, I apologize if I come across as condescending with my explanation. I don’t know how much knowledge you have in Flash, so I’m trying to be as basic as possible.
Firstly, his head and his body should be two separate movie clips. The head movie clip (MC) needs to be inside his body MC so that the head moves when the body moves. If you want something to happen when you click only his head, you need to add a script to the head MC that “listens” for whenever a mouse clicks on it. Here’s some example code (inside the head MC actionscript):
//This code adds an event listener that “listens” for whenever a mouse clicks the head.
//The first parameter passed into this function determines what type of event the movieclip is listening for. For ex. it can be click, double-click, when the mouse rolls over, etc.
//The second parameter is the function that you want to run after you have clicked the head MC.
//The rest of the parameters you don’t need to worry about.
this.addEventListener(MouseEvent.Click, FunctionToRun, false, 0 true);
function FunctionToRun(e:MouseEvent):void
{
//This removes the event listener (since I’m assuming you can’t click the head after it has exploded).
this.removeEventListener(MouseEvent.Click, FunctionToRun);
//Then you add whatever code you want for the head.
//Assuming you want to change frames of the head movieclip from a non-blown up to blown up state, you can use this code.
//This is assuming the head blown up picture is on frame 2 of the head MC.
(e.currentTarget as MovieClip).gotoFrame(2);
}
That’s about it. I hope it’s clear and best of luck.