ActionScript 2.0 :: Platform Character - Set The "hero" Movieclip To The Frame Named "nothing" ?

Jul 22, 2010

I am making a platformer and i got two problems with the hero.The hero is controlled with the following script.

code:
onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 0;
var gravity:Number = 2;[code].....

1. I can't seem to figure out how to set the "hero" movieclip to the frame named "nothing" when none of the keys that control the hero are pressed. (so the hero is doing nothing). When the hero stands still, it will still appear like he is walking or jumping (whatever has been done last)How do i tell Flash that something must happen when none of a certain group of keys are pressed?

2.When you jump, the "jump" frame of the hero is shown. But as soon as you move right or left while jumping, the "right" or "left" walk frames are shown. How do i tell flash to not show the "right" or "left" frames after pressing the jump key until the hero lands back on the ground? The instance of the ground is "ground".

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Platform Game 0 Can't Get Enemies To Face Hero

Nov 24, 2010

I'm making a platform game. The hero can move around, but the enemies are stationary. My problem is that I want the enemies to face the hero. The first enemy behaves correctly, but the subsequent enemies only behave correctly if I kill all the preceding enemies. I have added the hero and the enemies as Objects and put the enemies into an array called enemies. Both the hero and enemy objects have a direction property and an mc property that refers to their movie clips. This for loop gets called every frame.

for(var i:int = 0; i < enemies.length; i++)
{//face hero
if(hero.mc.x < enemies[i].mc.x) enemies[i].direction = -1;
else if(hero.mc.x > enemies[i].mc.x) enemies[i].direction = 1;
enemies[i].mc.scaleX = enemies[i].direction;}

View 4 Replies

ActionScript 3.0 :: Chasing Hero Game Character As A Square And The Enemies Are Circles At The Moment

Sep 11, 2009

i am making a game and i have my main character as a square and the enemies are circles at the moment. i have just made the circles home in on the main character, but my problem is when the enemies come inline with the x or y coordinates of my character they start vibrating/shaking. im not sure how to fix this. i have included my fla so you can easily see whats going wrong.

View 1 Replies

ActionScript 3.0 :: How To Make Character Jump Onto Platform

Sep 2, 2009

I am trying to make a character jump on to a platform this is my code. The block1, block2 etc are the blocks that I want my character to jump on

PHP Code:
var onBlock:Boolean;
var blockHolder:Array = new ArrayblockHolder.push(block1)
blockHolder.push(block2)
blockHolder.push(block3)
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkBlock)
[Code] ....

The onBlock boolean is used later but my problem is that the code doesn't work.

View 1 Replies

ActionScript 3.0 :: Flash : Collision Detection Between Character And Platform?

Aug 10, 2011

whenever I start my game my character just falls through the platform. No Compiler errors are appearing, and there's nothing in the outbox. I'm pretty sure it has something to do with my character not knowing that it must land on the platforms, but how would I write that?

View 2 Replies

ActionScript 2.0 :: Make The Character Jump When He Is On The Platform It Doesnt Work?

Nov 15, 2006

when i try to make the character jump when he is on the platform it doesnt work.

onClipEvent(load) {
speed=7;
jumping=false;[code...

View 3 Replies

ActionScript 3.0 :: Platform Game - Character Stops Earlier Before Collision To Right Wall

Nov 29, 2009

I m under the process to create a platform based game,but stuck in a problem ,its probably concern with x-axis, actually my player stops certain distance before right wall and with left wall too,i tried to reduce the distance but end up in failure,i have attached the concern fla.

[Code]...

View 5 Replies

ActionScript 2.0 :: Collision And Animation - Character Is Stopped Immediately When Touching (hitTest) The Platform?

Jun 14, 2010

Important: ActionScript 2.0Flash CS3I have some knowledge in Java and C++ which makes this easier... Im trying to make a game and the collision *** does not stop the character in its spot... if i set _y to 0 then it would go to the top of the screen... if i set _y to -1 each frame that the hitTest is active then the character goes through the platform and the rises by -1 (1 up) _y .... how can i make it so the character is stopped immediatly when touching (hitTest) the platform?

[CODE].....

View 6 Replies

ActionScript 2.0 :: [CS3] - Control Hero Movieclip With Movieclip Buttons

Jan 21, 2009

Originally, the client wanted to control "hero_mc" using the keyboard but now they would like to control him with buttons only. Here is the original code on the "hero_mc" which works as expected:

[Code]...

View 2 Replies

Professional :: Warning: All Instances Named 'head' Will Be Automatically Declared As JessHead In Symbols That Use Character As Their Base Class

Nov 3, 2010

In my library I have:A Sprite named Emily of base-class "Character" with a sub-sprite labeled "head" of auto-generated Class "EmilyHead".A Sprite named Jess of base-class "Character" witha  sub-sprite labeled "head" of auto-generated Class "JessHead". 

Flash compiles with the following warning: Warning: All instances named 'head' will be automatically declared as JessHead in symbols that use Character as their base class. In symbols that are linked to user-defined base classes, instances with the same name must be of the same type. And then the runtime error:TypeError: Error #1034: Type Coercion failed: cannot convert EmilyHead@3a0d1e81 to JessHead. at flash.display::Sprite/constructChildren() at flash.display::Sprite()at Character() I can turn of auto-declare stage instances in the Actionscript 3 panel, but then I have to manually add a public var for all sub-child's, such as the head sprite.  But then at least everything works as expected.  This is more setup than I'd prefer to do, but everything else about this workflow is very fast & easy.  What can I do to sidestep this error, while keeping the same workflow? 

View 6 Replies

ActionScript 3.0 :: Character Animation - When I Press Left Or Right Key - Draw Each Frame That Makes Character Movement?

Sep 24, 2010

I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.

View 4 Replies

ActionScript 2.0 :: Make A Movieclip Of A Character And When The Character Is Dragg?

Aug 11, 2009

i was wondering if any of you out there could tell me how it is possible to make a movieclip of a character and when the character is dragged about the screen by the curser, how do you make the characters arms and legs swing about in a realistic fashion.

View 2 Replies

Flash :: Address A Named Instance Of A Movieclip From The Class File Of The Movieclip?

Jun 1, 2011

I have a movieclip instance named 'placeholder' on the canvas, and I want to change the alpha of the named movieclip from it's class without effecting the alpha of all the movieclips of the same type. How would I specifically target the named movieclip instance that is on the canvas?

View 3 Replies

ActionScript 2.0 :: Referencing A Named Frame In An If-else Statement?

Dec 1, 2010

If I have a movie clip with named frames, can I reference the frame names in an if-else statement? For instance,

if (frame name = "frame1")
gotoAndStop.frame2;

etc. Is that doable?

View 5 Replies

ActionScript 2.0 :: Going To A Named Frame From External Html Page?

Mar 6, 2008

I have an html form page with a .swf navigation bar. I'd like to be able to click over to a second html page which contains a .swf file, and go directly to a named frame of that swf file.

Can I specify a named frame from the first html page like that?

View 4 Replies

ActionScript 3.0 :: Accessing A Named Movieclip In A Movieclip?

Dec 13, 2009

I have created a new instance of a movieclip and named it in as3.
 
I want to put this in another movieclip. How does this effect the reference because everything seems fine while the dynamic movieclip is just dealing with the stage. As soon as I put it in a movieclip, I get:
 
Error #1009: Cannot access a property or method of a null object reference.  at com::Gallery/instancesOut()
 
Heres part of my code:

for(var i:int = 0; i < 20; i++){ var transition:mcTransition = new mcTransition();
addChild(transition);  transition.name = "transition_mc" + i;  transition.x = i * 100;

I can reference using the string name but if I put the addchild in a movieclip it errors
 
Transition_mc.addChild(varTransition);

View 1 Replies

ActionScript 3.0 :: A Stage Instance Named Remains Null To The Frame?

Jun 6, 2011

For some reason, no matter what I try, a stage instance named 'track' remains null to the frame it's on. I've made sure that Auto-declare stage instances is checked. Is anyone familiar with this problem?

View 1 Replies

Professional :: Making A Frame By Frame Animation To Draw A Character?

Jul 26, 2010

I am making a frame by frame animation, where I draw a character, make a new frame and use the onion skin to slightly move my character. Is there a way to make a certain part faster than others? I made a character prepare to kick someone, but since i was doing it frame by frame it looks slow. So instead of taking out frames and making it look choppy, how do I make a certain part faster or increase its FPS? I tried making a new scene and changing its FPS, but that still changes the overall FPS.

View 6 Replies

ActionScript 2.0 :: GotoAndPlay A Certain Frame Label In An Swf Loaded Into An MC Named Host On _level0?

Aug 19, 2002

I have an swf loaded into _level0. On button release I want gotoAndPlay a certain frame label in an swf loaded into an MC named Host on _level0 to. I have the following:

on (release) {
_level0.host.gotoAndPlay("Main", "MainStart");
unloadMovieNum (2);
}

The unload part looks fine, and I am back to my orginal page. But the page did not jump to 'MainStart'. What am I forgetting?

View 1 Replies

ActionScript 2.0 :: Platform Game - Turning Off Variable In MovieClip

Feb 14, 2011

I am working on a platform game and I am having a problem with the script. I have a mc with my character in it named "mcMain", I placed all the script into it. Inside the movie clip I have 20 frames, the first 5 are standing, walking, jumping, crouching, and crawling. Frames 6-20 are an attacking animation. The problem is in frame 20 I want him to go back to frame one and turn off a variable (called "ram") in the movie clip.

The problem is with the variable ram (which is established in the onClipEvent(load) section of the script). I have it turn on when the character attacks and I want it to turn off after the animation is complete. The problem is it is not turning off. I have it targeted but it does nothing. I have tired both a direct and relevant target along with a _parent.ram = false;

Here is the script on the movie clip.
Actionscript Code:
//Establish VariablesonClipEvent (load) {
var speed:Number = 0;var walk:Number = 6;
var run:Number = 12;var grav:Number = 0;
var falling:Number = 0;
var jumped:Boolean = false;var jumpHeight:Number = 23;
[Code] .....

And here is the script inside the movie clip on frame 20
Actionscript Code:
_root.mcMain.ram = false;gotoAndStop(1);

View 3 Replies

Actionscript 3 :: Added Into Another MovieClip Container Named As Mc?

Aug 13, 2011

I have created 3 movieClips and I added into another movieClip container named as mc.

for(i = 0;i<3;i++)
{
imgBox = new box();
mc.addChild(imgBox);
imgBox.name = "box" + i;
}

[Code]...

View 1 Replies

ActionScript 2.0 :: Named Movieclip Instance Coming Up Undefined?

Sep 12, 2007

I have a named movieclip instance coming up undefined in AS2/CS3. the movieclip is on the stage, and I am having trouble accessing it from actionscript. does anyone have any ideas what might be causing the problem?

View 1 Replies

ActionScript 2.0 :: Make A Customize Character Frame?

Oct 28, 2008

I want a make a game where you get to customize your character and that is the character that you play with the whole game.

View 1 Replies

ActionScript 1/2 :: Dynamic Text Boxes One Named "item" And One Named "ssnumber"?

Jan 17, 2011

here is my new code that works for PART of my movie. i have two dynamic text boxes, one named "item" and one named "ssnumber" ssnumberNode works fine but itemNode does not. i bolded the parts that i think are relevant to the problems

[Code]...

View 3 Replies

ActionScript 3.0 :: Character Flipping Once Reach The Specific Frame

Aug 9, 2011

can someone teach me how to convert the code? when character reach frame 10,scale/flip the char horizontal. i tried e.currentTarget.scaleX=-1; but the char seems to move till off the stage.. without flipping the char,my char gone facing <--- instead of going ----->...

View 3 Replies

ActionScript 3.0 :: Running Movement Of The Character And The Second Frame Is On Standing Position

Dec 20, 2010

RIGHTNOW, Im doing my game development but I have problem based on my game control.this is my question..
 
I have two frames. the first frame is on running movement of the character and the second frame is on standing position.This two frames has only one kind of character,but I seperated the two movement in two frames witch are running and standing positon.my problem is how can I do the mouseEvent,if onclick the character will continue on running and if on release the character will do is to standing position.

View 2 Replies

ActionScript 3.0 :: Call A Movieclip Named Movie2 Using The "addChild"?

Apr 13, 2011

In my main timeline I have a variable "tipos = 5" for example.I want to call a movieclip named movie2 using the "addChild". The movie loads without a problem.My problem is that in my "movie2" I have to access my variable "tipos ", but I can't access it...The code "trace(tipos)" on my "movie2" returns an error.

View 4 Replies

ActionScript 2.0 :: Make The MovieClip Named "fish" Go To A Randomly Generated Spot?

Apr 6, 2004

I am trying to make the movieClip named "fish" go to a randomly generated spot. I tried using the tutorial, but I didn't understand the math, so I tried it with my own code. I'm not as much interested in getting this to work as I am knowing why it doesn't work.

PHP Code:

fish.onLoad = function() {
generatePoint();
}
fish.onEnterFrame = function() {

[Code].....

View 3 Replies

ActionScript 2.0 :: Put The Character Variable And Info In The First Keyframe And Refer To These Via _root In Any Frame

Dec 29, 2010

I am trying to make a game to learn actionscript. my game is going to have multiple keyframes, ie one for dungeon, 1 for a large map yadda yadda yadda. Things like the character i would like to be available to all keyframes. i am assuming i put the character variable and info in the first keyframe and refer to these via _root in any frame. However if i want to make a dungeon and use the dungeon scene variables i would use this.

right now since i am only on the making a dungeon part i can refer to anything using this or _root. Case: my dungeon scene consists of walls and paths. right now i can do something like if(_root["path" + yPos + xPos]) _root["path" + yPos + xPos].removeMovieClip;

i can also call the same code using this instead of _root and it works. when i add a main new main frame and move the dungeon scene from frame 1 to frame 10, will i still be able to inter use _root and this and have the same effect, or once i move the dungeon scene from frame 1 to frame 10 i will no longer be able to use _root. also i only have 1 layer.

View 3 Replies

ActionScript 3.0 :: Created Two MovieClip To Contain The Character Max And Luna?

Jan 3, 2012

I have two character to choose from, so I created two movieClip to contain the character max and luna. When I choose the desired one, it's added to a hero MovieClip. It works, the hero acts as a container and it is referred for the movements by the keyboard event. Now I want to target hero.character.gotoAndPlay for the animation in the timeline of the character movieClip in the Main class, but I can't do that. I tried to trace the instance character.name but it won't do the trick it throw the same error :
 
TypeError: Error #1010: A term is undefined and has no properties. at Main/fl_MoveInDirectionOfKey()

[Code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved