Spawning multiple instances of a sprite (shoot the balls).  Need help.

Hello.  I am currently doing a game in director 11.5 for a University project.  I decided to make a scrolling space shooter, but I encountered a problem.  A tutorial I found has created a limited 'Bank' of the balls of fire, allowing only a number on the stage at one point.  What I have to do is to let a single sprite ball off the edge of the page and copy essentially he and behaviours lingo to spawn another instance of the ball on the scene when the player fires (using the left button of the mouse in this case).  I also need this copy should be deleted entirely when it collides with an enemy or leaves the boundaries of the stage, otherwise the game will just run more slowly and more slow several shots are taken.

I heard that it is possible using the puppetSprite() method, but the API is not shine much light on the issue and no a literally hours of searching on google.  If anyone can let me know any method to do so, I would be very grateful.

On a related, when matter fired the bullet will need to intsect the situation where the mouse cursor was when the bullet was fired and then continue on a linear trajectory.  I worked on a method to do this, but it's not very effective or efficient (the speed of the balls would be determined by the cursor of the mouse is how far from the ship of players and I think that there is probably a less intensive calculation method to achieve) and as I can't spawn bullets from now I really don't know if it will work yet.  If anyone has any advice on how to best implement this mechanic, even once, I'd appreciate your comments.  Thanks in advance.

-start-up of the main script, movie named "main script.

on startMovie

_movie.idleHandlerPeriod = 0

end

on mouseDown

Bullet = script ("ball script") .new)

end

-end of movie script
-start of the script of the frame, frame script named 'script-framework '.
on exitFrame me
go part
end
-end of the frame script
-beginning of the script of the ball, parent of script named "ball script."
bulletSp property
minY property
pObjTimer property
the new me
-create sprite
-find an empty channel from the channel in the foreground
CNT = _movie.channel.count
Repeat with i = cnt until 1
If sprite (i) .member = (member 0 castLib 0) then
-make sprite
bulletSp = channel (i) .makeScriptedSprite (member ("bullet"), _mouse.mouseLoc)
bulletSp.scriptInstanceList.add (me)
minY =-(member("bullet").height)
-start moving the ball
pObjTimer = timeout () .new ('ball' & i, 3, #moveBullet, me)
output of repetition
end if
end repeat
return to me
end
on moveBullet me, _objTimer
bulletSp.locV = bulletSp.locV - 1
sendAllSprites (#collisionTest, me)
If bulletSp.locV<= miny="" then="">
me. Destroy()
end if
end
to destroy me
pObjTimer.forget)
Channel (bulletSp.spriteNum) .removeScriptedSprite)
end
-end of the script of the ball
-beginning of the collision test script, script behavior called "script of collision."
on collisionTest me, _spOrg
If sprite (_spOrg.spriteNum) .intersects (sprite (me.spriteNum)) then
sendSprite (_spOrg.spriteNum, #destroy)
end if
end
-end of the collision test script
1 paste the script 'major' in one of the film's script and give it the same name.
2. double-click on frame 1 in the script to frame channel and past the image inside script.
3. create a new script, assign a Parent script in the property inspector and stick the ball in there script. Name it "script of ball."
4. create a new script, assign a script of behavior in the property inspector and passed the test of collision inside script. Name it "script of collision."
5. create an image of the ball and make sure the registration point is defined to be at the high point of the ball. Name the image of Member 'ball '.
6 Create rectangle shapes to the top of the screen, and then drag and drop the script "collision" on them.
7 press the Play button and move the mouse around the scene while clicking the left button of the mouse to shoot bullets. The balls will be destroyed when they reach the top of the scene or when they hit a rectangle.
8 study scripts. If you need the commented code, or a more complete explanation/walk-through of what happens in the code then let me know and I'll give it.

Tags: Director

Similar Questions

  • Question about multiple instances of Thunderbird running at the same time

    I read that when you start Thunderbird by clicking on its icon or the shortcut must only load once, even if you click on it several times. It should be just a window of TB. If I click on the shortcut/TB desktop icon, it behaves like that. I can click several times and that a single TB window will open and be active.

    However, if I run the 'quick launch' TB on my windows 8.1 (or no matter what windows) taskbar, I get mulitple TB windows to open, as much as I want. So if I click on TB icon in the quick launch once, I get a single instance of it. Twice, I get two, and etc. In the quick launch any program behaves like that. He starts programs with a single click and launch again and again.

    Only, I click it once and get an instance which is good and how it should be. But this behavior with the quick launch is ok? It must do this not with Thunderbird? Thank you.

    There is usually no advantage by running multiple instances of Thunderbird, unless specifically do you these race with different profiles. In practice, if they are allowed to use the same profile, the first Thunderbird should should acquire the profile and therefore block the others, although this may not become apparent until you try to salvage something, for example, a message, or to change certain settings.

    Your multiple Thunderbird work successfully? They all show the same mixture of accounts, folders and address books? Can all or part of them save and make changes?

    If this is the expected behavior, (i.e. some "typical" windows) I do not like; He does not play well with profile blocking and I think that lead to problems.

  • Multiple instances of ColdFusion Builder on the same system?

    Hi people,

    Four of us working remotely in my company.  It is not uncommon for use us to all the remote desktop in a system reserved for our use and three of us CFEclipse at the same time.  We have recently installed ColdFusion Builder on this system and found that it would only allow a single instance of ColdFusion Builder to run.  When you try to start a second instance of CFBuilder would show the screen flash and then nothing more.

    Is anyone aware of workarounds or other changes that will allow us to run multiple instances of CFBuilder on the same system?

    Thanks in advance,

    Thomas Woestman

    Will address this issue.

    But for the moment as a solution, when you want start generator CF if there is file .bolt please remove the .bolt of

    C:\Program Files\Adobe\Adobe ColdFusion Builder\. And you will be able to launch even while the other kept open.

    Thank you

    Krishna

  • 'Use the cartridges SETUP' error on the printer, need help!

    I bought the printer last year in the months of August and after 6 months of use, it started having problems printing wireless. I always had to use USB to print from my laptop so I was recommended by people in this forum to reset my printer to the factory.

    I have reset several times and nothing worked, so I was advised to do so by using the Cancel button and the middle button that reset the printer. Now the problem is it says "Cartridges use SETUP" and my printer is out of warranty, it expired last month. I'm really confused about what to do. I am a student and I still have the print job and I can't afford a new printer. Calling support has no idea what to do and email support does not because of my warranty as you exhale.

    My printer is a HP Deskjet printer Wireless 3070. Product number is CQ191B.

    I really need help has begun the new year of college and I have a lot of missions to print.

    Hi ExPLOiT786

    Dragon-fur asked me to chime in with this. I will send you a private message on this in order to proceed.

    Ciara

  • I forgot the password need HELP

    I forgot my password for parental control and need to unlock them to install the new modem software.  Need HELP.

    http://support.Microsoft.com/default.aspx/KB/189126

    "Microsoft's strategy concerning lost or forgotten passwords"

    Microsoft cannot help you recover the passwords of the files and Microsoft who are lost or forgotten product features.

    Mick Murphy - Microsoft partner

  • Rule business spawning multiple instances of itself

    Hello

    I have a business rule that a user has today launched off of the planning. After the first launch, this rule has somehow given birth to another instance of itself every five minutes of the second up to what I killed all (11 in total). The user swear it he launched only once, and I think that he (as much as he could not have spaced it so exactly if he had tried). This rule has an aggregation at the end, and the rules mutually deadlocked and slowed the system to a crawl until I killed the sessions. Everyone has never seen this or know what risk? We had happen once before, but believed at the time that it is the user who has made multiple launch.

    Thank you

    Sabrina

    It could be related to this problem? Re: planning of business starting 5 min rules

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • GREP with multiple instances closer to one of the other

    I have problems with GREP outside bases. I use GREP to apply styles to text in a paragraph. The text has been given to me in this way:

    Color begins as black < ital > < ital > and is gradually moving towards white < ital > < ital >.

    I use this: (< ital >). + (< ital >), which works very well in most cases. It fails on the example above, because it also italicizes "and evolving gradually towards", that I don't want.

    Anyone can be so kind as to point me in the direction of an explanation of what I'm doing wrong here?

    Thanks in advance

    By default, GREP is greedy and try to match as much as possible the text. In your example

    Dave-o-design says:

    Color starts out as Black and progressing gradually to the white.

    your correspondence . + will match everything, from the first to the last code. To enter non-greedy mode, which corresponds to the the shortest possible match, change. + à. + ? Like this:

    .+?

  • Creation of the database - need help

    Hi all

    I am new to the creation of the database. We have a project starting early next month.

    The application acts as an interface to multiple users. A user will have access to its together authorized data.
    So, he/she can/don't should not access the data of other users. This is the scenario with all other users.

    We hope that we will have the large amount of data specific to each user. We have identified some ways to do this:

    1. create separate schemas for each user.
    2. create a unique layout and have a main table that will have all the details of the user. On this basis, the data will be created in the tables.
    3. do you have a unique layout and create partitions partitions/sup in the tables for each user.

    We have identified the above, with a minimum exposure of creation/maintenance of database. So, we do not know who would be the ideal way

    Can you please suggest the best thing to do here.

    Thanks in advance.

    If the data structure is exactly the same for all these users and the number of users is high, a better way is to its virtual private database. With DPV, you have a transaction data, but each user will have access to its own lines only.

    http://www.Oracle.com/technetwork/database/security/index-088277.html

    It is more extensible than the solutions you provided and are very transparent after the initial installation.

  • HP 50 g RPL program to list the factors needing help the formatted output; Matrices, vectors, lists, etc.?

    Hello

    I have not always perfer the output of the DIVIS HP 50 g.

    DIVIDED lists all the factors of a number in a way that is ineffiecent and confusing when there are many factors of a given number.

    For example, when you run 1000 DIVIS you are treated to a large "block" of numbers organized vertically in such a way that only 4-5 of the 16 factors of 1000 are still visible to you without additional keys.

    I'm trying to create a program that simply formats the output of DIVIS differently when there are a lot of factors for a given number. I'm a newbie to the USER RPL. I have the factors that come out a while loop in this format. (100, 10) Unfortunately, my time loop depends on these factors enters NOT the battery until AFTER he calculated all the. I need to find a way to store a set of factors by the execution of the loop in a kind of variable, and then remind each other both on the stack at the end of the program execution. If the code is necessary for you to see, I can post it. The problem is that it is unclear how many factors will be present at this stage. It will be the original number / 2 because I have through each pair of factor in jurisdiction parens with R-> C. In addition, the capture method must be in the loop because that if it is not the loop won't work correctly because the method by which he organized the factors in their concerned couples depends on a process of battery undisturbed during the execution of the loop. Leaving the parens at the bottom of the battery causes there are an odd number of factors in the stack, which invalidates my program for various reasons. In addition, it would be useful to include a function that could test whether or not the number of factors of an odd number, because I will need to include separate code for this. I don't know any such function in USER - RPL, but I am a beginner in this area. Thanks for any help!

    Zekelegge

    Ranothil wrote:
    (...)

    For 1000, my dream program would output;

    (...)

    Try this:

    ' DUP DIVIS SWAP ON / SWAP R-> C EVAL.

    or:

    "DIVIS DUP DUP SIZE 2 / 1 SWAP SUB DUP UNROT / R-> REVLIST C EVAL.

  • Strange marks on the Filterglass - need help

    Hello

    After the first testshots with my F5, I noticed a few marks on the edge of the filterglass (you can see on the photo of attaced)

    I sent it to sony, they said they have erased all the brands in the 'white room' section and back. Today, I got my camera back but the same notes are there too. If anyone noticed the same problem, is it perhaps normal?

    Thanks for help

    OLAF


  • Hi, I just bought the G550, need help

    Whats up forums?, I just bought the g550, it came with 4ddr3 RAM with windows 7 32 bit, so I think I would upgrade to the 64 bit VER, but I found that it came with a lot of cool software like the thing of the volume and the program and drivers via for energy savings, so could you guys link me to all the software and drivers for this notbook as I'm going to install a new copy of the 64-bit so I wan't these drivers and programs, thanks, bye

    You can download the drivers and applications for windows 7 64 bit from here.

  • Using windows XP: whed download afthe the beginning of download Turbo tax program an error message appears saying "user lacks administrative privileges to perform the task"need help"

    I bought a turbo tax download and during the download of the process I ge an error message (1321) saying ' windows install has sufficient privileges to install or change the file. "

    Hello

    1. have you logged as administrator?

    2 are you able to install other programs?

    I suggest to follow the steps in the following article and check if it helps.

    http://TurboTax.Intuit.com/support/IQ/install-product/error-1321--Installer-doesn-t-have-permission/SLN12336.html

    If you are always faced with the question, then I recommend you contact Turbo tax support for more help.

    http://TurboTax.Intuit.com/support/

    Hope this helps

  • Back up the server: need help with synchronization of Microsoft.

    At work, we have a server lets just say its called \\backupsrv and we have My Documents of each user directed their C drive to the backup to the backup server. We also had to each user and with them logged in we ensure that their documents point to the \\backupsrv and we go to my computer\tools\folder options and click to activate offline files and synchronize with log off. Finally, we right-click on users my doc folder and select make available offline.

    The problem we see is that when we look at our network in a program called Orion that shows us how our network is used and time when most bandwidth is used. We notice on certain PC, it syncs when some users log on in the morning. Who uses a lot of bandwidth since it's synchronize users my docs for the backup server when is this. The majority of users is another branch and their my sync docs for the backup of the server that is on the road to the main branch. We checked these PC users and they are set to synchronize when you sign off the coast. Anyone else have problems with Micrsoft synchronization over a network? The operating system that we use on the PC is WinXP SP3

    Hi valley_girl1919,

    I would recommend posting your question on the TechNet Forums as they specialize in supporting the professionals:

    http://social.technet.Microsoft.com/forums/en-us/categories/

    Thank you for answers!

  • Try a repair of the system need help

    Does anyone know the user id and the password that is listed as step # 5 in the Startup Repair: frequently asked questions pre installed recovery options? Thank you

    Hello

    The user ID is the name of the user account and if you have set a password for connection which would be your password.
    If you are not using any password, just click OK.
    Also, I would say this:
     
    I hope this information helps you!
  • I forgot the password need help cant closed system don't remember log in password just changed and simply forgotten! Help, please...

    OS Vista sp 2 IE 8

    I just changed my password, log and I can remember? Help!

    http://support.Microsoft.com/default.aspx/KB/189126

    "Microsoft's strategy concerning lost or forgotten passwords"

    Microsoft cannot help you recover the passwords of the files and Microsoft who are lost or forgotten product features.

    http://social.answers.Microsoft.com/forums/en-us/w7security/thread/39f56ef0-5d68-41AD-9daa-6e6019c25d37

    Read theBANNING of cracking of passwords information tools information provided in these forums in the thread above posted byBill fill MSFT, moderator

    See you soon.

    Mick Murphy - Microsoft partner

Maybe you are looking for