ActionScript 2.0 :: Collision - Character Shall Stop Movement If He Hits A Geometry

Aug 7, 2008

am pretty new to Kirupa and Flash. I have a little problem, concerning a character hitting a wall. What i have: a char that can jump and move around by the arrow keys. What i need: character shall stop movement if he hits a geometry. But being able to start movement again, besides through the geometry. I'd like to reach this with gskinners CheckForCollision class. Have a look here: [URl] But i didnt manage my code to get it work. So maybe you could leak me some information on how to get this done. Heres my code so far:

[Code]...

edit admits: so far i have a character mc called "player" and one called "level". i would apply the code to the player, and it would be cool to have the possibility to check collision of the player with multiple MCs, not only the level.

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Play To And Stop (character Movement MC)?

Jul 16, 2004

I have a MC which is a lady that raises her arms up and down. From the main timeline i want to tell that "ladyMC" (also sitting on the main timeline) to play to and stop on specific frames. I have tried it two different ways but am obviously missing something. The first way i tried just using an if/else and getting the current frame #.

Code:
if(lady._currentframe < 22){
lady.play();

[code]....

View 2 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 :: Get A Movie Clip To Play Once When My Character Hits It?

Aug 24, 2007

I've got a problem with a game I am creating, I want a movie clip to play once when my character hits it, it has a stop function at the end of the movie clip, but as long as the character is on top of it, it continues to loop, how do I get it to stop at the last frame?
Here is the script applied to the movie clip:

onClipEvent (enterFrame) {
if (this.hitTest(_root.bubMC)) {
play();
}
}

All I've been able to do was make the last frame extremely long and load an alternate movieclip without the hittest function applied that runs the animation.Essentially, I am asking, "How do I make a piece of actionscript run only once", like:

onClipEvent (enterFrame) {
if (this.hitTest(_root.bubMC)) {
play(ONLY ONCE BUT AFTER THAT DON'T DO IT AGAIN);
}
}

View 1 Replies

ActionScript 3.0 :: 2D Character Movement With Camera Movement

Jun 10, 2011

how to get the camera to move with a character? At the minute he just moves off screen when i press right rather than the camera following him.

View 3 Replies

ActionScript 3.0 :: Game: Character Walks Around And Stops Walking When Hits A Hole?

Jul 7, 2011

I have a game where the character walks around the screen and stops if she hits a wall or a hole etc... - typical. HOWEVER - I coudn't get her to stop walking. Is there any standard code for this. If you tell to stop walking then she can't walk back out either etc... Also, she walked into the hole a little so being in the hole she definately couldn't walk any more not even back out as she would be walking inside the prohibited zone.

View 3 Replies

ActionScript 3.0 :: Stop An Object When It Hits Another?

Nov 12, 2009

Im making a sort of maze game and have a ball that moves up, down, left and right when the corresponding arrow key is pressed. What I want to do now is introduce some walls, how do I make the ball stop moving when it touches a wall? (so it doesnt pass through the wall)

View 1 Replies

ActionScript 3.0 :: Detect Collision (character Is Fully Inside) Over

Nov 5, 2008

i have two movie clips mcTrap and mcCharacter.how can i detect collision (character is fully inside) over the trap door?

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 :: Hit.Test For Detecting Laser To Character Collision?

Oct 4, 2002

how i can get these lasers to work in the correct manner. For some reason, 2-3 seconds in the game, the game goes to the next frame. I can't get the second player's fire to stick with him as he travels across the screen. Here's the fla.

View 14 Replies

ActionScript 2.0 :: Make Something Stop When It Hits Another Thing?

Jan 7, 2004

I am wanting to make a game, and I need a gravity code that works great. I want gravity, a jumpibg code, and then a code to make something stop when it hits another thing.

View 2 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 :: Movement Started With Key Press And Not Stopped Until Collision Detected

Feb 5, 2005

I want to create movement in a movieclip when an arrow key is pressed. I want the movieclip to start moving and not stop until a hitTest recognizes a collision with another object and then tells it to stop. I want the key to only have to be pressed once to start movement and not have to stayed pressed down. How would I do this?

View 2 Replies

ActionScript 2.0 :: 8-way Character Movement?

Mar 14, 2011

Right now I have all the animations for each direction in a movieclip within one movieclip.However, when I use the arrow keys to move the walking animations don't playWhen I stop, the appropriate animations play, however. Here is my code:

Code:
onClipEvent (load) {
facing = 1;

[code]....

View 1 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 :: Character Movement Flash Mx?

Jun 11, 2005

i have made the movie clips for my character walking in 4 different directions but i have no idea how to make it so when the up arrow key is pressed, for instance, the movie clip of my character walking up is played.

View 7 Replies

ActionScript 2.0 :: Character Movement Script

Dec 17, 2011

my movement script looks like thisActionScript2.0)

[Code]....

View 1 Replies

ActionScript 2.0 :: Character Movement Script For A Game?

Apr 15, 2010

I'm sorry if this is the wrong section. But I'm looking for help with my actionscript coding. I'm fairly new to Flash. I've only scripted some simple websites so far and this is the first time I try to make a flash game. I started yesterday but I'm already having problems with my script.

I have a scene with 2 layers: one with my character and one with the bounds (ground, ceiling and walls).

Inside my character movie clip, I have this: Which is basically a bunch of frames labeled and with the action to stop();. Each one containing another movie clip with the respective animations. So the idea was, when I press "A", jump to "walk left". And it kinda worked, but I have some problems and I'm not really sure how to solve them.

[Code]...

View 2 Replies

ActionScript 3.0 :: Making Iphone App Character Movement?

Aug 24, 2010

1. Character Movement: as you know the iPhone/iPod touch doesnt have any sort of keypad and so when creating a game that has character movements onscreen buttons need to be used. My question is this; how exactly do i make it so that when the player taps/holds down a button (is the same as mouse clicking it) my character moves.
 
2. adding a physics style fall: once i have created this movement using on screen buttons i now need to create a jump, so what i need is something so that when the player clicks the "jump" button the sprite moves up a certain amount and then stops moving up and falls down.

View 2 Replies

ActionScript 3.0 :: Character Movement And Shoot Not Working?

Nov 8, 2009

I'm doing a simple game where you move the character using the arrow keys and shoot using the Mouse. The character rotates based on the Mouse angle. I have two problems: when I move the character, he moves once, then stops then moves again as normal. My other problem is that when I click over a MovieClip, the bullet goes to the wrong angle.My moving function:

Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
function keyHandler(event:KeyboardEvent):void {

[code]....

View 2 Replies

ActionScript 3.0 :: Floor Not Recognised By Character Movement?

Feb 8, 2010

I am designing a character to move right and left but the character is not recognising the floor movieclip and is falling straight threw the floor.I have attached a zip file with the flash document sample and associated Actionscript file.

View 2 Replies

ActionScript 2.0 :: Restricting Game Character's Movement?

Aug 9, 2010

1. How do I prevent my scuba diver from leaving the screen? As when i hold either up, down, left or right long enough he will leave the stage entirely.2. How can I make my sharks enter the screen at random rather than having them enter from the same position each time? Here is my code:

(FOR MY SCUBA)
onClipEvent (load) {
xspeed = 10;

[code].....

View 3 Replies

ActionScript 3.0 :: Flash Character Random Movement?

Feb 24, 2011

I want to make my character moves randomly that is character will base on random numbers(for example generate 4 random numbers) and character's favorite(for example fast food, west food, Chinese food) to move. The character will move randomly with 4 direction that is move up, move down, move right and move left(any speed will do). Should i have four function with four movement.

View 1 Replies

ActionScript 2.0 :: Character Movement Though Rotating Round Surface?

Feb 10, 2008

i want a character to move on a globe. the movement of the character is shown though not by shifting the positions of the caharcter but by the rotation of the surface of the globe. buttons are used to move leftward and rightward.

Also, there are three layers of the globe to show depth. how would i script it so that the layers of the globe rotate at different speed?

i've uploaded a zipped of a fla file.

View 3 Replies

ActionScript 3.0 :: Character And Background - Creating Illusion Of Movement

Mar 12, 2009

Right basically I have a character and a background. The background scrolls as you press left or right on keyboard to create the illusion of movement. I want the character to flip when you change from holding down left to right and vice versa, but when I do the following code it doubles the size of the character once and then it stays. It flips fine but in the transformed fat size.

Here's the code:
var mySpeed:Number = 10;
function keyIsDown(evt:KeyboardEvent):void{
if(evt.keyCode==Keyboard.RIGHT){
walkingPlane_mc.x+=mySpeed;
greyCharacter_mc.scaleX=-1;
[Code] .....

View 4 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 :: Codes They Are Using A VerticalChange Variable For The Time-based Character Movement?

Jun 2, 2009

sample codes. In those codes they are using a verticalChange variable for the time-based character movement.But I can't figure out how this code works and why we needthose calculations - char.dy*timeDiff + timeDiff*gravity?So here is the code:

Code:
// assume character pulled down by gravity
var verticalChange:Number = char.dy*timeDiff + timeDiff*gravity;

[code]....

View 4 Replies

ActionScript 3.0 :: Stop Drag On Collision?

Mar 29, 2010

I am TRYING to get an mc to stop moving when it contacts another mc using hitTestObject and a stopDrag command The probem comes is that I want to be able to drag the mc again, but because it stop dragging while it is in contact with the target I can't move it again.Can anyone tell me how I can stop an mc dragging without losing the ablility to drag it again

function hitMe(event:Event){ if (top_mc.hitTestObject(phone_mc) || foot_mc.hitTestObject(phone_mc) || body_mc.hitTestObject(phone_mc)){  reply_txt.text = "CONTACT"; removeEventListener(Event.ENTER_FRAME,hitMe);  body_mc.x --;body_mc.y --; 

[code].....

View 2 Replies

Stop A Rectangle From Going Past An Object After Collision Is Detected?

Oct 11, 2009

Assuming, for a rectangle that is controlled by the user using the arrow keys, that I do the following[code]...

Assuming that works in detecting the collision, what would I use to actually stop the rectangle from progressing through the wall?

View 1 Replies

ActionScript 3.0 :: Stop Object From Moving Further When Collision Occurs?

Feb 22, 2010

As the title says: Stop object from moving further when collision occurs.

Right now I'm trying to make a sliding puzzle. So far I have a block which I can click and drag around, and a few walls which are the boundaries. What I'm trying to do is make an area where the block can slide within the boundaries. So when you try to drag the block into an direction it will stop, whether you got mouse_down or mouse_up. My script so far

Code:
stop();
//Sliding Blocks
MCBlock1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

[Code]....

Also I need to use a lot of boundaries, so if there's a way to apply this script easily to several objects

View 1 Replies







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