Help please - display objects
How can Hey I get my items to display? In my class, I have a function that creates objects and they fall at random in the rows, but showing only 1. And I used trace(); to test how onstage and he says 4 but only 1 starting to fall. I think that there is something wrong with the method I use to create the objects in lines. Here is the code: package { import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.utils.Timer; SerializableAttribute public class Main extends MovieClip { public var enemyA:Array = []; public var birdA:Array = []; public var rowNum:int = 1; private var gap: int = 100; private var obj_no = 2; public var timer: int = 0; public var time_limit = 10; public var TimerSpeed:uint = 1000; public var MyTimer:Timer = new Timer (TimerSpeed); public var enemy1:mychar = new mychar(); public var TheBird:BirdChar = new BirdChar(); public void Main() { The constructor code } public void activateGameControls() { createEnemyF(); createBirdF(); this.addEventListener (Event.ENTER_FRAME, loopF); MyTimer.addEventListener (TimerEvent.TIMER, TimerHandler); MyTimer.start (); } public void deactivateGameControls()
{
addChild (TheBird);
addChild (enemy1);
removeChild (TheBird);
removeChild (enemy1);
}
public void createEnemyF()
{
for (var i: int = 0; i < rowNum; i ++)
{
for (var j: int = 0; j < obj_no; j ++)
{
enemy1.x = Math.Random () * stage.stageWidth - enemy1.width;
enemy1.y = - I * (gap + enemy1.height) - 30.65;
enemyA.push (enemy1);
addChild (enemy1);
trace (enemy1.x, enemy1.y);
}
}
}
public void createBirdF()
{
TheBird.x = 270,95;
TheBird.y = 350.95;
birdA.push (TheBird);
addChild (TheBird);
}
public void loopF(event:Event)
{
updateEnemyPositionsF();
updateBirdPositionsF();
hitTestF();
}
public void updateEnemyPositionsF()
{
enemy1.y += 2;
}
public void updateBirdPositionsF()
{
TheBird.x = mouseX;
}
public void hitTestF()
{
If (TheBird.hitTestObject (enemy1))
{
gotoAndPlay (5);
deactivateGameControls();
trace ("The Bird Hit Enemy 1'");
}
}
function TimerHandler(event:TimerEvent)
{
timer += 1;
If (timer is 50)
{
MyTimer.removeEventListener (TimerEvent.TIMER, TimerHandler);
MyEventArgs;
gotoAndPlay (4);
}
ElseIf (timer == time_limit)
{
gotoAndPlay (5);
deactivateGameControls();
}
}
}
}
(1) what is mychar? Given the way you use it, it takes asigned class to a MovieClip symbol in your library
-the name suggests a kind of text, which is not appropriate
-the class names should begin with capital letter
-I would like the enemy name
(2) I noticed that you create only one instance of your enemy (new mychar())
-If you want multiple enemies to fall from the sky, you must create multiple enemies (in loop...)
(3) If you want to move each enemy, you need to store in the table. You can do this when they are created (in the loop for)
(4) you move your enemies by getting then one by one on the table and by incrementing the value 'y '.
(5) would definitely get rid of the variable "enemy1" - it's useless. Use enemyA instead - it can contain all your enemies
Explanation of my code:
// an array in which you will store references to your enemies var enemyA:Array = []; // constant defining how many enemies you want there to be const MAX_ENEMIES:int = 10; // loop for creation on your enemies for(var i:int = 0; i < MAX_ENEMIES; i++) { // local variable to temporarily store current enemy we're adding var enemy:DisplayObject = new Enemy(); // set enemy's x position, random from left edge to the right edge of the screen enemy.x = Math.random() * stage.stageWidth - enemy.width; // set enemy's y position, in his own row. each enemy is a row higher than the previous one enemy.y = - i * (gap + enemy.height) - 30.65; // add the enemy to the display list so he is visible on the stage addChild(enemy); // trace his position trace(enemy.x, enemy.y); // store the enemy in the array so we can address him later enemyA.push(enemy); } //then onEnterFrame or timer call updateEnemyPositions function updateEnemyPositions():void { // loop for enemy movement - falling off the sky for(var i:int = 0; i < enemyA.length; i++) { // get a reference of i-th enemy in the array var enemy:DisplayObject = enemyA[i] as DisplayObject; // move enemy a bit more downwards enemy.y += 2; } }
I really can't put it more simply, there cannot be any simpler. -Read 5 times and then try it.
I do not have the game for you, you must understand what I say and apply it to yourself, to your game. Otherwise you'll never be able to do it yourself, sorry.
Tags: Adobe Animate
Similar Questions
-
When I started to update my iphone to ios 10 and watch 3.0, cannot already display the pictures of my watch. Logo of loading only. And he thinks it will take a hayss of 1000 years. Help, please
Hello
If the software on your watch is being updated, leave your watch and your iPhone until the process is complete (including the not remove your watch on the charger):
-
I tried to erase and reset my iphone 6 s. But why is it taking so long? For more than 24 hours. Is this normal? The phone displays just the apple logo and wont open. Help, please. Thank you in advance.
Hello
Follow the instructions here:
If you are unable to update or restore your iPhone, iPad or iPod touch - Apple supports
-
I forgot my password and got my iphone disabled after several attempts. its display to connect to itunes, but I am unable to connect to itunes too. How can I unlock my phone without losing any data? Help, please
In short - you can't
IF you have a computer with iTunes on which you did a prior backup - the phone will be recognized and iTunes offer todo backup before it clears your device - that - except if you know the access code the content cannot be saved
-
Trying to connect to the PS3 online, my router is microsoft but the SSID (or our wireless network name) is not displayed! Help, please!
JamieHello
1. What is the brand and model of Microsoft Router?
If you use Microsoft MN - 700 router see link below and follow the steps.
MN-700 Base Station Configuration Guide
Download the guide and open page 3 that contains instructions for recording in the router. Page 16 has also the steps to configure the router to broadcast the SSID
If in case you use a Microsoft MN - 700 router, I suggest you to provide exact model name to get more information about the issue.
I hope this helps.
-
Help, please
Hi RobbyUtah,
Try to press the ARROW keys to CTRL ALT (Alt + Ctrl + top or down arrow). You will get the normal screen. To disable this feature, you will need to click on start-> settings-> Control Panel-> Intel (display drivers) and disable access keys. or right click on your desktop-> properties-> settings-> Advanced-> Intel media Accelerator Graphics Driver-> Graphics Options-> access keys.
I hope this helps.
-
HP PC HDMI->; Sony Bravia HDMI = no display! Help, please!
Hello
I'm usually well informed about the connections for digital devices, but I'm completely baffled by this situation and would REALLY appreciate your response as soon as possible, thanks in advance!
Problems - the following statement of what I've done:
I bought HDMI - HDMI Cable to connect my model of PC HP A6355 Phenom 9500 Quad Core (which have a HDMI port) for Sony Bravia LCD HDTV (which of course also have Port HDMI!)
I turned off TV and PC, then connect the HDMI cable to the two end to each device
Turn on the PC and the TV
I checked every singal channel AV and PC on TV - no connection regonised
I checked my display settings and set it to lower the resolution and trying to replicate the monitor (still doesn't)
Have no FN key on my keyboard
I took off the cable from the PC and connect it to my HP laptop and it worked perfectly fine! (this is the part where it puzzle me most!) one thing I notice is when I connect the cable from the laptop on tv - display automatically to survey and ready for me set the appropriate resolution setting - he didn't do it on my desktop PC...
Why?
My HP PC is 32 bit operating system
NIVIDA GeForce 8500 GT
I also checked Device Manager to see if my HDMI port works on my PC, but there is no option to select HDMI (unless they have another name for it IE bus usb etc?)
Help, please! Thanks again
Hey there,
I just want to say that I have now solved the problem...
Apparently my Nivida GeForce driver is not updated, make sure that you update your regularly and you will have no problem!...
A smile and a big smile on my face seeing now works!...
Thank you even if no one answers, it seems content to my brain so that it works properly!
Thanks again
-
Original title: received message 'disk full '. I can see 933 GB of free space when I display the properties of the operating system (c :)) help, please!
New computer - Dell Inc. 05DN3X (CPU 1), MS Windows 7 64-bit SP1, processor Intel Core i7 930 at 2.80 GHz, 6.00 GB Triple - Channel DDR3 @ 666 MHz, 977 GB Western Digital WDC WD10EALX - 759BA1 (SATA).
Problem:Downloaded a program (32 MB) (SRIM 2011.exe) commonly used to work and tried to extract it to a new folder on the OS (C :) - received message 'disk full'.) I can see 933GB free space when I discover the properties of the operating system (c) - Quota is turned off.Have used the program mentioned above (SRIM.exe) several times before using different operating systems XP to work without problem...Help, please!THXGiven that this was written in 2011, I'm sure you understood something at this stage. However, the post also has much a views, so I think it might be a persistent problem, so I'll post my solution:
When I copied the file SRIM - 20xx.e in a folder of SRIM-20xx under Program Files, I had a "Disk full" error when trying to extract the files, even though I had a lot of space on my hard drive and without limits. After a bit of messing around, I like the solution is to move the SRIM-20xx folder on the desktop, and then unpack it. After extraction, which leaves you with a lot of seemingly useless files, double-click CONFIGURATION and the installation will begin appropriate. Installation will create a file under Program Files, there will be no need to make things happen later, simply remove the meantime extract the folder to your desktop computer.
-
LR6 print module image is displayed not only white canvas. Help, please
LR6 print module image is displayed not only white canvas. Help, please
Hi abelardo,
Could you please try the following steps:
(1) quit Lightroom
(2) deleted my "Lightroom 6 Preferences.agprefs" file to the place mentioned in the article:
Preferences and other locations of the file file | 5 Lightroom
(3) restart Lightroom.
(4) then check the print module.
Concerning
Sarika
-
I can get to resize the display bar at the bottom right. It extends off the screen. Help, please?
Irene
Have you tried the resize in the window upper right button. There are 3 buttons, we close the window one he minimized no date limit it and the other allows to switch between full screen and a smaller screen. Click on the last one and see what happens.
-
Why Ai CC 2014, when I use a pathfinder on two objects tool, their anchor points break a bit from where they were? I search in all the nod to under VIEW options & could not find the culprit. Help, please!
It looks like "snap to grid of pixels" just once more.
Uncheck the box "align new objects to the pixel grid" in the menu of the transformation Panel.
Select the objects and uncheck "snap to grid of pixels" in the transformation Panel.
-
How can I display the Tamil fonts in Adobe CS6? Help, please...
Hello
I create a document in Tamil. Normally, I type in Google document. Then copy and paste into Word. It works perfectly.
Now I create a poster in Adobe illustrator. I type in google and pasted into Notepad. It works perfectly.
When I copy and past in Adobe Illustrator the police does not appear correctly.
I have urgent need. Can someone help?
I did a search on Google and found the following. But I am unable to find similar to Adobe Illustrator CS6 settings
Thank you Ellis House. The issue has been resolved. Message from David that you pasted above was really helpful.
In the preferences-> Type-> the text engine options I selected 'Middle East', unknown world that was "Southeast Asia", after the Tamil letters display correctly. Thank you very much...
I saw another post that says that I need to enable view source option.
http://helpx.Adobe.com/Illustrator/using/Indic-support.html
Unfortunately, I don't have any option informant. My screen is different
I have a few Tamil Born installed. When I tried to change the Tamil police source, it no longer works.
I have another font called Larson. When I changed the character displayed in Tamil Latha police, but all spelling badly shot in Tamil.
Help, please. Enjoy.
Thank you
Notes; I am new to Adobe illustrator, so if I made a stupid mistake, my applogies.
You are out of luck in your version. Support for the Tamils was added in CC
http://helpx.Adobe.com/Illustrator/using/Indic-support.html
You could try
http://www.WinSoft-international.com/en/news/ScribeDOOR-CS5.html
(also available for CS6)
-
Your help please with my problem. Thank you.
Try the settings > Safari > clear the history and data from the Web site. That could help.
Can you identify some pages where this happens? I took a quick glance and the pages I saw seemed reasonable.
-
two other programs to lose control of cursor when loading firefox. Nitro pdf & on screen takeoff on center software. Help, please.
When I use the programs listed above and firefox is loaded, scrolling through these programs takes me at the edge of the window. I can't scroll 3 lines I can when FF is not loaded. I hate to say it, but FF is certainly the culprit.
OK, if I may ask, what also happened when Firefox is in Mode safe? That will do this troubleshooting step, is whether this is caused by an add on that you have in your profile. Questions to troubleshoot Firefox in Safe Mode
Moreover, the fact happen on the touchpad, as well as with an external mouse (if it's a laptop, if not, please ignore)Reset Firefox preferences to troubleshoot and solve problems
Does this happen with accelerated scrolling on? This setting is in preferences/Options > Advanced Options > general
Please post back with your results, thank you!
-
I have a watch that has become not matched with the iPhone with it's Setup. It is locked with a password and the dial of the watch indicates "Wrong password" and I have to open the App to Apple Watch on my phone to re - activate the entry of access code and try again. However, the iphone has stated that on the phone became not paired with the watch, so I can't do anything, there is no option to change the password and I can't pair the watch with the phone because it is locked. This is my boss's phone... Help, please!
If you have forgotten the password for your Apple Watch - Apple...
< edited by hosts >
Maybe you are looking for
-
The acct of mail PW is stored in password manager. He doesn't want on later mark for the mail, only at the start of the program. If I get the PW, it just ask again... and again. If I cancel, it retrieves the mail.
-
Need a battery for Satellite PS181N-02HS70
help please! I need a battery for Satellite PS181N-02HS70. released in the Japan. The Russia has never delivered. Laptop for 10 years. Somewhere there must indeed be parties or their equivalents. Where to call someone ask?
-
How do the smaller font for printing on a printer wireless from an ipad with ios v9.2?
I have a mini Ipad. I have files in the Notes I want to print on a HP 4635 while a printer using airprint. When I print the file, the font is too large. I would like to know how to make the font smaller when I print on the printer. My ipad is upd
-
OfficeJet pro 6830: scanning problem
Hello I am trying to scan several pages... but the option ' save under... ". ' is not available. I would like to save it as a pdf file. As soon as I clicked on my computer, the next option is to 'Start scan '. Please notify. Thank you
-
OK here it goes. My friend had a HP, HD sound disappeared I can't even a dir to go up above. I put the recovery disk, they sent him to HP and just, he goes back to restart it then comes up with an error. I tried the Seagate Software and the HD has di