• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Duplicating an object and make it move across the stage

Guest
Jul 29, 2015 Jul 29, 2015

Copy link to clipboard

Copied

Hello,

I am having a problem developing a game in actionscript 3.0. The plan for the game is to have planes fly across the screen and the player needs to shoot it by clicking on it. As the player gets more points, there needs to be more planes flying across the screen. No matter what I try I cannot get it to work. Can anybody offer any coding suggestoins for the coding in general, and duplicating the object and spawning it off to the side of the stage.

TOPICS
ActionScript

Views

201

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 30, 2015 Jul 30, 2015

Create the plane as a library object and assign it a class name (say you name it Plane).  To create a new instance of it you just use...

var another_plane:PLane = new Plane();

addChild(another_plane);

planes.push(another_plane);

The last line places the newly created plane in an array that you would define ahead of creating any so that you have some way of targeting the different planes that get added to process (move, etc) them.  When one of them is no longer in play you can remove it from the arra

...

Votes

Translate

Translate
LEGEND ,
Jul 30, 2015 Jul 30, 2015

Copy link to clipboard

Copied

LATEST

Create the plane as a library object and assign it a class name (say you name it Plane).  To create a new instance of it you just use...

var another_plane:PLane = new Plane();

addChild(another_plane);

planes.push(another_plane);

The last line places the newly created plane in an array that you would define ahead of creating any so that you have some way of targeting the different planes that get added to process (move, etc) them.  When one of them is no longer in play you can remove it from the array so that it no longer gets processed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines