ActionScript 3.0 :: Making Stage Follow Player?

Nov 21, 2009

I am trying to make the stage follow the player in AS3 (basically, so the 'view' follows the player and he remains in the center of the screen throughout).Here is what I tried:

Code:

this.x = player.x-stage.width/2;
this.y = player.y+stage.height/2;

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Making An Enemy Follow The Player?

May 27, 2010

I've been working on a game for my AS3 class that involves enemies randomly spawning from all direction and following the player in an attempt to collide with him. I can get the enemies to spawn from one direction as well as move in a single direction but I can't get the spawning from all sides or the following the player around to work.

I've been at this for a couple of weeks now and followed several suggestions and tutorials (including one from here) with no success and this thing is due by tonight . Here's the code from my enemy class. All of the code of the game is done through AS files with no coding done within movie clips or on the timeline.

package
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;

[code]....

View 14 Replies

Professional :: Writing A Class For Making The 'enemies' Follow The 'player'?

Feb 14, 2011

I'm an actionscript beginner and trying  to write a class to  make the 'enemies' follow the 'player' (shown below). I'm trying to write it such that it takes two MovieClips as arguments, and moves the first one toward the second one. When I import the Class try to use it in Main.as by typing  " var followPlayer:FollowPlayer = new FollowPlayer(fishMov0, player);", I get the following error:
 
"ArgumentError: Error #1063: Argument count mismatch on jab.enemy::FollowPlayer/followPlayer(). Expected 2, got 1."

[Code]...

View 3 Replies

ActionScript 3.0 :: Making Stage Follow Object?

Jan 1, 2010

Say I am moving an object around on the stage, walking from point A to B across the stage. I want to make the object the center, so the stage is centered on the object, so when I walk from point A to B the stage moves with me.

View 5 Replies

ActionScript 3.0 :: Making Movieclip X And Y Follow That Of Another

Jan 5, 2011

I'm making a game and have zombies spawning on a stage using math.random()

What I want to achieve is their health bars follow them above their heads, However they aren't spawning when I use:

ActionScript Code:
public function iceZombieSpawn(e:TimerEvent) {
iceZombie = new IceZombie(Math.random()*stage.stageWidth, -100); // Create new ice zombie at random x position (width, height, health, hitCount)

[Code].....

They do work when I specify a specific coordinate however won't get the desired result.

View 9 Replies

ActionScript 3.0 :: Making Audio Pan To Follow Objects?

Apr 23, 2011

i'm generating a horizontally scrolling image gallery and i want audio cues to fade in & out as well as pan with the images.so as the image enters frame left and moves towards center frame, volume increases, pan moves from 100% left to center.as image passes and leaves frame left, volume decreases, pan moves from center to 100% right.i have not worked with sound in flash in this way before & extensive searching hasn't returned any results!

View 3 Replies

ActionScript 2.0 :: Making Ball Follow A Line?

Jan 14, 2003

I have a line that is 800 pixels long. The line is a gradual curve, that gets kinda steep at the end. I want this ball to go along the line. How do I make the ball move to the right, and stay on top of the line. All I have now is...

PHP Code:

onClipEvent(enterFrame){
this._x +=35;


Now I need to add something to make it follow the line. The instance name of the line is.... "line" without the quotes of course.

View 2 Replies

ActionScript 2.0 :: Making Eyes Follow The Cursor [FMX]?

Nov 14, 2002

I know how to make something follow the cursor (e.g. a ball that moves where your cursor does). However, I'm having a lot of trouble figuring out how to do what I need to for an animation, namely make eyes follow a cursor.Here's the situation: I need to make a graphic (the eye in the middle of the eyeball) follow the cursor (i.e. look up, look left, look in any number of diagonal directions) depending on where the user moves the cursor. But the eyes, obviously, need to stay put in one static spot and move in a very limited region (the entire white part of the eye, but not beyond it).

Furthermore, the eyes start out staring at the user. How do I additionally make them dart to the edges where they'll be looking around once the cursor is moved?

View 9 Replies

ActionScript 3.0 :: Making A MovieClip Follow A Line (shape)?

Oct 23, 2009

I am tracing a line between two movieClips (called pontoA and pontoB) using the following code:

var my_shape:Shape = new Shape();
addChild(my_shape);
my_shape.graphics.lineStyle(4, 0xFFFFFF, 1);

[code]......

View 3 Replies

ActionScript 3.0 :: Making A Button Follow Random Array Numbers?

Jan 13, 2010

I have 10 movieclips on stage called mc1 mc2 etc ect and then I have one button which makes one of the mc's alpha = 0;The only thing is I would love the evenlistener add the number created by the array to be put after mc & "array number".So what the button should do is create one of the mc's visible whilst all others are not, and this should happen randomly without an mc showing up twice.

View 0 Replies

ActionScript 2.0 :: Good Method For Making Movie Clip Follow A Curve?

May 1, 2006

I'm working on a game where you have a car that will drive along a side-scrolling terrain, and it needs to folllow the hills up and down and rotate accordingly. Because the front wheel and back wheel will need to be at different heights as the car moves, I'm wondering what the best way to make it rotate correctly is?

The height detection works, and the car will follow the hills but that's just using one point on the car movie clip to test with - it needs to use the front and back of the car.

View 1 Replies

ActionScript 3.0 :: Path Movement - Mc To Follow The Path Drawn Out By The Player's Mouse And When The Player Clicks Again, It Erases All Of The Path?

Jul 18, 2010

So I've created a script where a mc is clicked on and the player can draw a path using the mouse. I'm trying to figure out how I can get the mc to follow the path drawn out by the player's mouse and when the player clicks again, it erases all of the path.my code is below

Code:
import flash.display.Sprite;
import flash.events.MouseEvent;[code].....

View 14 Replies

ActionScript 2.0 :: Making The Simple Player Using The Player Component Preinstalled In Flash?

Jun 3, 2010

I am trying to make the SIMPLEST POSSIBLE MP# player using the player component preinstalled in flash.It is very simple, the code is as follows:

Code:
on (release) {
player.contentPath ="Song.mp3"
player.play()
}
("player" is the mp3 component)

This works if I want a single track to be selected and played.Now, I need it to AUTOMATICALLY LOAD THE NEXT TRACK, which I will input in the code.I am thinking something like this:

Code:
player.onSoundComplete = function() {
player.contentPath ="Song.mp3"
player.play()
};

But this is not working.

PS: I know an XML file would be the best here, but I don't want to use it. I just want to enter the next track's code inside the swf.

View 2 Replies

ActionScript 3.0 :: Can't Make Camera Follow The Player (mouse)

Sep 15, 2011

how to make the camera follow my hero (mc), I think the problems involve me using the mouse to move my player instead of the keyboard. This is my code:

var distx:Number;
var disty:Number;
var gravity = 0.6;

[code]....

The result is my Hero following my mouse and when I click it jumps. But the camera is not following it.

View 2 Replies

ActionScript 3.0 :: Make Enemy Array That All Follow Player?

Feb 12, 2012

I am working on a first person shooter game, however i dont know how to make all the enemies that get created, to all move towards the character every few seconds then moving randomly for a few seconds, with the frequency increasing as the enemies move closer to the player. Getting that part is easy enough, the problem is i dont know how to make each enemy be able to do anything really independantly. Since my game works in a an external AS file, i cant access any of the class variables from within the movieclip of the enemies. Is there a way i can do this?

i already have code which rotates and moves the enemy towards a given point, as well as random movement, what i dont know how to is access the variables of the main class from the movieclips of the enemies, and vice versa ive found a way to do this, however it means i have to out the movement code within the enemies, as well as collision code, and that just laggs the hell out of the game when there is 5 or more enemies.

View 0 Replies

ActionScript 2.0 :: Shooting Game - A Gun To Follow The Player, But The Coordinates Are Messing Up And Going To His Feet?

Oct 25, 2010

I'm making a flash game in AS2, and i am having troubles with my gun, i have fiddled with it for a while now and i have narrowed down the problem, but i can't fix it. My problem is that i want a gun to follow the player, but the coordinates are messing up and going to his feet.

Code:
onClipEvent (enterFrame) {
_y += (_root.player._y-_y)/1; //This code makes it goto his feet, but the gun no longer follows player when he jumps.
_x += (_root.player._x-_x)/1;[code].............

View 1 Replies

ActionScript 3.0 :: MC To Follow Cursor But Not Off Stage?

Aug 27, 2010

I have some info boxes that show up upon MOUSE_OVER of an MC.  I set their position to mouseX and mouseY once I want them to appear.  The problem is that when I mouse over something near the edge of my stage, the info box appears beyond the stage's bounds.  Is there a way I can contrain the infobox X,Y so that it does not go off the state?
 
Right now, this is how I define the X,Y of the text box (pretty simple).
 
trlinfotxt.x = mouseX;trlinfotxt.y = mouseY;

View 4 Replies

ActionScript 3.0 :: Make Stage Follow Object?

May 5, 2011

How can i make the stage follow a object?

View 3 Replies

ActionScript 2.0 :: Making Movie Clips Follow A Custom Line But They Movie With The Cursor

Feb 4, 2009

trying to make a movie clip follow a custom drawn vertical line, the movie clip follows the cursor but only the y axis

I have added an example of what i mean and the file i need it to happen to

ps the vertical line needs to be hidden.

View 8 Replies

ActionScript 3.0 :: Flash Eyes Follow Mouse Off Stage

Aug 25, 2010

So, I figured out how to make eyes follow the mouse on the stage, I need the eyes to follow off stage as well (banner ad) I have been looking high and low with little luck until now.. This guys cooked up a way to track the mouse off stage with the help of AC3 only -> Example My questions is, is it possible to mix these two together?

View 1 Replies

ActionScript 3.0 :: Bullet Fired From Turret / Follow And Hit Moving MC On Stage

Aug 11, 2009

i recently learned how to program a tank-type game.. i was able to make the turret follow the mouse and fire bullets that would move to the direction the turret was pointed at..what i'm trying to do now though is make the bullet follow an object moving on stage.. sort of like a heat-seeking missile..

View 2 Replies

IDE :: Follow Mouse - Limit The Area Where The Clip Can Follow?

Oct 26, 2009

I found this tutorial [URL] and is wondering if I could limit the area where the clip can follow? I'm planning to have my cartoon's EYEBALLS follow the mouse move.

View 1 Replies

Actionscript 2.0 :: Seek Bar Making For FLV Player?

May 22, 2009

Now i am doing a FLV Player. But how to make a seek bar for that.?

View 5 Replies

ActionScript 2.0 :: Making A Buffering Video Player?

Jul 15, 2004

tutorial for making a buffering video player, with scrubber etc that lets the viewer see how much of the video has loaded whilst they watch it. I've been searching for ages but to of no avail!I'm using MX, not MX 2004

View 2 Replies

ActionScript 2.0 :: Making An Advanced Internal MP3 Player?

May 31, 2005

we need some movie clips.Place in a movie clip (MC) with the instance name "volume" of a line with a width of 250 exactly, do it with the properties tab.Once you have done that double click it. Inside this MC lock the layer with the line on it, and lock it. Create a new layer, and on that put in a picture of a slider, and give it the INSTANCE NAME, "knob_mc".Now, make another image,which will be easy for users to click on, make the the width of this, 250 exactly also. Instance name it mask.

Now, create your buttons. Name the buttons for the songs respectively, song1, song2, etc...Also make an image of a speaker, with no sound wave coming out of it. Make it an MC, then, inside this movie clip insert 4 keyframes of the speaker,each with one more sound wave than the other, starting with no waves. Put stop on each frame, in the actions.Then on the last frame,frame 5, make the mute image, also put stop on the layer.

Place in a movie clip with the instance name "slider_mc" of a line with a width of 200 exactly, do it with the properties tab.Once you have done that double click it. Inside this MC lock the layer with the line on it, and lock it. Create a new layer, and on that put in a picture of a slider, and give it the INSTANCE NAME, "knob_btn".Now, make another image, which will be easy for users to click on, make the the width of this, 200 exactly also. Instance name it mask.Then insert a picture of speakers, width of 100 exactly, instance name of speaker. Then inside that, create an image to show the amount of balance to one side. With a width of 50, instance name of balance.

Others;Play button, instance name "playbut", 2 keyframes, frame 1 play image, frame 2 pause image.

Stop button, instance name "stopbut".
Next button, instance name "next".[code]......

View 12 Replies

ActionScript 2.0 :: Making A Fullscreen Enabled Flv Player?

Oct 27, 2007

I got a problem while making a fullscreen enabled flv player.I developed a player which will got to fullscreen but the problem comes when the monitor is wide. There comes blanh space left and in the right side of the video.

my code is like this

function goFullScreen() {
Stage["displayState"] = "fullScreen";
flvplayer._width = 600;
flvplayer._height = 450;

[code].....

flvplayer is the movieclip which contain the video.

View 4 Replies

Java :: Making A Web Player Frontend For My Media Server?

Feb 21, 2011

I have a small media server. It's actually a Netgear GoFlex Home (NAS) running Plugbox Linux. It's currently running a bunch of servers HTTP/FTP/WebDAV/DLNA/Webmin etc and I want to create a frontend for my multimedia that I can access from the internet. (I preimarily use it as a DLNA media server).At first I considered using a Java Servlets backend with a Flex based frontend but that fact that I can't use Flex Builder from work (licensing) and I'm unwilling to pay a few hundred pounds for it, that's out of the question.

View 1 Replies

ActionScript 2.0 :: Making MP3 Player Play Next Track Automatically

Mar 10, 2006

[URL]

On the first page, my player begins to play like a radio show. i have different sections which are all individual tracks. the player works and plays each track when i manually press next or previous...but it doesn't automatically play through all the tracks. instead it pauses after the first track and i have to manually press next.

here is what i used...can you find the problem:

stop();
playlist = new XML();
playlist.ignoreWhite=true;

[Code].....

View 2 Replies

ActionScript 2.0 :: Making An FLV Player - Adding Timeline And Fullscreen Options?

Jun 26, 2009

I am in the process of making my first FLV player in Flash CS4, for videos I plan to upload on my site. The play/pause/rewind buttons seem simple enough. However, I have searched and can't find-a timeline 'duration' that tells how many minutes have been played and how many total there are-a fullscreen button that toggles full/not fullscreen in the browser-if possible, some way to manipulate the timeline (e.g. drag the cursor forward to make the movie skip ahead)or explain to me how to do thisAs I said, I have searched for the above and found the play/pause/rewind tutorials but no timeline/fullscreen ones.

View 2 Replies

ActionScript 3.0 :: Making Mp3 Player Play Random Songs Upon Load

Aug 16, 2010

Im new to the AS3 game but I need some help with something. I have built a pretty good website mp3 player but it plays the songs in order. I want the the mp3 player to play a different song everytime it loads.[code]

View 2 Replies







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