I want to make an action side scrolling game, i need some advice from you all.
I wrote my to do list here:
To do list:
Create my project's class.
Create hero MovieClip and class.
Create enemy MovieClip and class.
Create background level MovieClip and class.
Add MouseEvent, MouseClick, x y position to hero class.
Add x y position, a movement to right and left to enemy class.
Add background MovieClip to my project's class.
Add event and event listener, but still don't have a clue where to put it.
.... i don't know what's more to add to this project...
Is my to do list is bad? if yes, please tell me the right way so i can learn how to make a good plan for my project.
My advice is start coding now!
I will find out if something is missing in the road,
best,
Alvaro
Related
Hi there,
I'm making a game prototype, a “hero” which is controlled by the mouse when clicked. To visualize the player's velocity direction and the direction from hero to mouse, I have made two MovieClip classes: “Direction_mark” and “Direction_pointer”, respectively. They are NOT nested due to issues I've run into when dealing with the possibility.
When trying to make “pushing camera” (where the hero moves and the background is fixed until you reach a certain point near the stage limits and the environment starts to move), though, I had to make the “Directions” movie clips stay in the same position as the hero, even if this moves. So I simply wrote this (the event listener for the function is onEnterFrame):
//In the Direction_mark and Direction_pointer class:
//...
function update (e: Event){
//code...
this.x = Game.hero.x;
this.y = Game.hero.y;
//more code...
}
//...
But it doesn't work: I experience a certain “easing”, the “Directions” follow the hero in and elastic-like effect which is not desired at all.
Does somebody know why this happen, and how to solve it? This is the first time I experience this problem. Any help, advice or comment would be greatly appreciated.
Thank you very much in advance.
PD: Probably not relevant, but I'm using CDK to manage collisions. Maybe takes too much CPU and makes it work wrong?
So, I am trying to make a flash game with a bomber plane with a rear-gunner. I have made the plane a movieclip and, inside that, have the gunner movieclip. I am trying to use key controls to move the plane and have the gunner follow the mouse cursor. I am not certain if there is a way to make the gunner movieclip stay attached to the plane and move independently. Right now the only thing that works is instantiating a gunner and adding it to the frame, but I am having problems keeping it in the right location while the plane moves.
you can refer to a movieclip in another movieclip by naming it
Picture example:
http://i.stack.imgur.com/weNeF.png
then you can refer to it in your actionscipt by writingyourPlane_mc.gun Example: yourPlane_mc.gun.rotation = mouseAngleToPlane
I know this question has been asked before but as a noob i did not understand the answer so im hoping someone can explain a little more for me.
I have an arrow animated along a path using a motion tween I want when a button is clicked for an endless stream of arrows to follow the path, this would be easy if you could put more than one object on a motion tween but you cant? Can anyone help with the code id need to make this happen.
Is there a way to repeat the movieclip again before its finished to give this effect?
Do you have any code, or example of exactly what you're trying to accomplish?
You can use multiple instances of the same movie clip... So (for the sake of explanation) you could animate your arrow once, make sure it's its own movieClip, put it on the stage, and test your movie...It will loop over and over. You can drag as many instances of this movie on to the stage and they will all play, over and over until it's told to stop.
If you need ALL of the arrows to be one movie clip, as to be one addressable object, you can simply select all of your positioned arrows, and convert those into one movieClip (right click, convert to Symbol)
Of course all of this can be controlled precisely through code, but need to know a bit more about what you're trying to do. hope this helps a little...
The function play() will loop your movie forever, unless you have a stop() function somewhere.
yourMovie.play();
If you want to "repeat" / "reset" a MovieClip at any time, use gotoAndPlay() :
yourMovie.gotoAndPlay(1);
If you want to verify if you are at the end of your clip, use the properties currentFrame and totalFrames :
if (yourMovie.currentFrame == yourMovie.totalFrames)
{
// ex. if you want to stop
yourMovie.stop();
}
Ref : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/MovieClip.html
Hope that help. Be more specific, if it doesn't answer your question.
Is there a way in AS3 to make a the mouse ignore a certain movieclip? I need it to be on top of the other movieclips (due to transparancy effects), but have it in a way that allows clicking on the movieclips underneath it. I know about ".mouseChildren = false", but that only makes all the stuff inside that movieclip unclickable, but it still functions as a "barrier" on top of all the others buttons.
Is there a way to do this, or do I need to remove it completely ?
You need to set both .mouseChildren and .mouseEnabled to false before you can click on objects behind the MovieClip. This makes the mouse ignore the objects within the MovieClip and the MovieClip itself.
Source: http://pixelfumes.blogspot.com/2008/01/clicking-through-movieclips-to.html
EDIT: Oops, didn't see that comment by Alex, sorry.
I have this small project HERE. Right now it barely does anything but make the character move.
I move the character by using <s:Move>. Now as you can see on the link to my project page, it moves to where you point the mouse and click. I want to be able to stop the character from moving if it hits another object or in this case, the "tree". Is there a script in AS3 that will let me detect collisions or controls that are overlapping each other?
If my question is a bit lacking information, please comment back here and I'll update it with more details as you need.
Please and thank you!
All DisplayObjects have a a method called hitTestObject(obj:DisplayObject) that tests when one object overlaps another. You can read about it in the Tree class, DisplayObject class, or any class that extends DisplayObject.