ActionScript 2.0 :: Stop Randomly Moving A Moveclip?
Nov 10, 2003lets jsut say like were randomly moving a moveclip around how do i click on it and stop it?
View 3 Replieslets jsut say like were randomly moving a moveclip around how do i click on it and stop it?
View 3 Repliesim currently making an "AS3 beat em up" ala streets of rage or double dragon.Currently i have my character moving and a few animations done and i am trying to figure out how to make attacks work.I have some "basic" animation for his attack, but im not sure how to get it to work correctley.What happens is, if you press control (the attack button) whilst the character is walking he just keeps moving and is stopped on the attack frame.I want the character to stop moving if the attack is pressed and once it is released start moving again.
hero.gotoAndStop('still');
var left:Boolean = false;
var right:Boolean = false;[code].......
I want to have a few movie clips moving randomly over my flashsite. They will look bugs. And I want them to move in the direction the head is pointing.I have tried the random movement tutorial here on Kirupa but can't get the mc to rotate in the direction it's moving.
View 14 RepliesI am creating a banner with a "moving target", but the target keeps moving under the copy text of the banner, making it illegible.here is my random movement code (Swiped from kirupa if I recall ) :
//special thanks to Suprabeener for the code
function getdistance(x, y, x1, y1) {
var run, rise;
[code].....
I use Flash 5
I went to this (click HERE) site. After a moment, it takes you to the main site.
The top banner is moving randomly over 3 or 4 pictures.
I am creating a banner with a "moving target", but the target keeps moving under the copy text of the banner, making it illegible.
here is my random movement code (Swiped from kirupa if I recall ) :
//special thanks to Suprabeener for the code
function getdistance(x, y, x1, y1) {
var run, rise;
run = x1-x;
[code]....
I have tried modifying the " width = 300; height = 180;" line, but it does not seem to be changing much, if anything. I am trying to bound the random movement to the bottom 180 pixels of the composition.
I wasn't quite sure how to describe my problem in the subject. I have a plane MC and a crate MC. The plane only flies along the y axis from the bottom of the screen to top. Along the way I want it to randomly drop the crate MC. My code is below. The problem is that the crates spontaneously keep spawning and not near the plane.
function movePlane():void
{
var tempY:Number;
[code].....
I'm working on my first game engine with AS3 and I'm hitting my first real setback. The idea is that the player controls a centered "turret" on the screen and can't move. Enemies come from all 4 sides and move towards the player. I have all the enemies spawning, randomly, on the edges of the screen. However their movement is silly, because I've coded it like this:
Code:
if (x > 300)
{
[code]........
I want the final result to be a stage with a certain number of circle MC's moving around. I have made the circle MC, and added the AS so that it will start at a random point with a random color, then start moving around randomly. I want to make it so that In the beginning the document will duplicate the movie clip x amount of times, using a for loop. I want to then have all the new circles move around, and when two circles hit each other, they will dissappear, using the removeclip function. You can only use this on duplicated movieclips though, so how would i make all the circles duplicated? Is there a way to duplicate the original movieclip x amount of times then delete it? Or is there a way to remove the original after it is in a collision? Also I don't know how to do the collision detection. I am thinking of using a hittest, but would I just do it with a for loop? Is there a way so that if an MC hits any other MC?
View 3 RepliesI have a MC that follows the mouse. I want to do so the MC will smoothly/softly stop when i stop moving the mouse. Is it hard to code, And it would be very nice if someone could do some code for it
View 2 RepliesMaking a ship game because I am incredibly original.. With that aside, I have a problem. I have a function to fire bullets from my ship based on its rotation which works.. it uses this code on creation: ember ho jis ny mmujhe block kia hai
[Code]...
The above code is in my Ship class so I can easily make the bullets achieve the correct rotation. And to continually update its position, in the bullet's class:
x += Math.cos(rotation / 180 * Math.PI) * speed;
y += Math.sin(rotation / 180 * Math.PI) * speed;
So that all works well. But I have another class, EnemyBullet, which randomly generates and uses similar code to set its direction and movement. In my ship class:
[Code]...
I gather that the rotation is therefore always horizontal, but can't for the life of me see why? Can anyone give me an answer? Assuming it's simple enough because the code I used to setup the rotation is the same working code I have used to turn a movieclip towards the mouse..
I have gone through the tutorial on this site regarding random movement. But I need it to be kept in a frame. This is the code(from this site)
Code:
function getdistance(x, y, x1, y1) {
var run, rise;
run = x1-x;
rise = y1-y;
return (_root.hyp(run, rise));
} function hyp(a, b) {
[Code] .....
Lets say I make an physical border for the element. A "box" 200x100 and this box is centered. How do I keep my random moved element inside this "box" or frame you may call it.
I have a bunch of dots moving randomly on the screen. They are all copied and pasted versions of one MC with some script attached.Over the top of them is a giant invisible button. When I click the button (anywhere on thescreen) a VISIBLE button appears. When I click again (anywhere onthe screen) I want all the randomly moving dots to move towards the VISIBLE button.
View 2 RepliesI have three MCs set up and each one has a set of quotes in it. There is one quote per frame and what i'm looking to do is to have it cycle randomly through the frames when a button is pressed and then stop on a random frame after a certain time.
View 7 RepliesI'm trying to get a looping matrix and then randomly stop. I am still pretty new to coding in flash. I still have not tried to put the random stop in but here is what I have so fare and it is not working.
var matrix_array:Array = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z", "?", "<", ">", "!", "`", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "+", "|", "/", "=", "_", ",", "[", "]", "{", "}", ":", ";");
function() {
[code]....
I've been making a Flash animation in AS3 for quite some time now and I'm just about finished, except whenever I go to test it, it will always stop at a certain point. First of all, I definitely do NOT have a stop script there. It's 27 scenes long. It will always stop roughly 11 minutes and 10 seconds in. Why does it do this?
View 2 Replieswhat wrong with the functin 'stopFish' Without this function the fish in the tank swims but when I add it, it doesnt anymore. I just want the fish to stop swimming after I clicked it and start swimming after another click.
View 1 Replieshow to randomly animate circles moving around inside a bigger circles? the small circles will have a collision effect on each other and on rollover of each individual circle, the name of it will come out in the bottom.. so the big circle will act as a wall preventing them from coming out..
View 1 RepliesIm going to attatch the fla on here...I am also going to give you the script viewable here...im completely a beginner so i made my self notes
also this is not all my coding im just learning off of it to create my own project... What coding would i use to tell the mc to stop scrolling once it reaches a certain x coordinate? for example x=0 (left side of stage) or x= -484 which is when right side of picture is at right side of stage... and can i setup math for it to automatically determine the correct x coordinate (based off mc width) to stop at?? if there is easier scripting to do the same....fill me in
oh and x is off of the stage typically...this is panoramic pics im scrolling
[Code].....
ok here is the scene
_root.playa
_root.playa.feetMC
_root.corneria
_root.corneria.limitsMC
[Code]...
I have this code where I want edge_btn to move to the left side of the stage, but I can't figure out how to get it to stop. It just keeps going. Also, I have edge_btn rotating the entire time in the beginning of the timeline.
[Code]...
I am making a new site, and was making buttons that looked a little similar like this buts on the left) and wanted that to do with Actionscript.I followed a tutorial on Kirupa on moving stuff with actionscript
Code:
onClipEvent(enterFrame) {
speed = 30;
[code].....
I am making something like a slot machine and the main number (a movieclip placed in separate layer) moves vertically continuously.I made a button and how do I make the main number movie clip stop moving after pressing the button?Our office has Flash CS3 and all the actionscripts are manually written.
View 1 RepliesI am using a magnifying glass as part of my portfolio but when I click on another section and this loads an external swf above the main movie, because you can still see the main movie below, you can see the magify glass still moving as you move the cursor above?any ideas how I can stop the magnify glass moving while i am on the external swf above?
View 29 Replieshow to get the textbox to stop moving after i set the textbox location with the first click.
[Code]......
I have a ball moving around the screen, position updated on ENTER_FRAME. My problem is that there is a considerable amount of flicker going on. I have thought about using something like TweenLite to move the ball but as the position is being updated frame-to-frame I don't think that will work.[code]...
View 2 RepliesI want to stop the movieclips movement when it hits a wall (another movieclip). The example below works, but after the collision the movieclip 'blocks' all movement to the left...
For now the example with the leftArrow key;
variables to check the key, if it's hitting the walls and if it's moving or not:
var leftArrow:Boolean;
var speed:int = 10;
var hitting:Boolean;
[Code]....
I am a beginner to AS and I am having trouble here: I want to move a dog across the stage. I have two frames one with a movie clip with a dog animated like it is walking and the second frame he is standing still. I want to take him to the end of the stage and stop him when he gets to frame 2.[code]...
View 1 RepliesI am trying to limit the area in which the character (mcMain) can move I want to be able to keep it in an area (mcBuilding) I also have another area (inwhich the character is not supposed to get to) (mcBackground). (Also I want to be able to to make a dynamic text box that starts at 100 then decreases by 5 when the enemy (mcEnemy) hits mcBuilding and also that it gets removed)
View 1 RepliesI have a movieclip moving around on key presses and I was wondering what is the best way to stop it moving off the stage? I was thinking of putting hit tests around the edges but wondered if there was a better way?
View 1 Replies