User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18

Thread: multiple instances spawning at multiple places

  1. #1
    No Products Registered

    Join Date
    Mar 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multiple instances spawning at multiple places

    Alright, so I've got an enemy object, an enemy spawner object, and an object that's the resolution of the window and follows the window at all times. My previous way to spawn enemies was when the spawner overlaps the screen, and there are no enemies on screen, create an enemy. This has allowed for one enemy of each type, but now I want more.

    If there are two instances of spawners, I want each to be able to create one enemy when it comes on screen, instead of one spawner creating two. I want to do all this with multiple instances.

    So, is there a good way? I know how to do stuff like fastloops with spread values, but thinking about this situation makes my head hurt.

  2. #2
    No Products Registered

    Join Date
    Feb 2009
    Location
    Texas
    Posts
    825
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    you could do this,

    [color:#FF0000]if spawner overlaps screen
    no enemies on screen[/color]
    [color:#33FF33]spread value 1 to Alterable Value A (spawner).[/color]

    [color:#FF0000]If Alterable Value A is greater than or equal to one[/color]
    [color:#33FF33]turn flag 0 on.
    Set Alterable Value A to 0[/color]

    [color:#FF0000]If flag 0 is on[/color]
    [color:#33FF33]create enemy at (wherever you want the enemy to be created)
    turn flag 0 off
    only one action when event loops[/color]

    if this does not give the disired effect, then check out Angelfox's mario bros. example and look at the group named block. if u look closely, i think that can explain how to do it

  3. #3
    No Products Registered

    Join Date
    Mar 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    Nah, that isn't working because it's only doing it when there are no enemies on screen. I want it so that even if enemy 1 is on screen, spawner 2 can still create enemy 2.

    The Mario Bros. example didn't help either.

  4. #4
    No Products Registered

    Join Date
    Feb 2009
    Location
    Texas
    Posts
    825
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    then change

    [color:#FF0000]if spawner overlaps screen
    no enemies on screen[/color]
    [color:#33FF33]spread value 1 to Alterable Value A (spawner).[/color]

    to

    [color:#663366]if spawner overlaps screen[/color]
    [color:#3333FF]enemies on the screen is less than or equal to 1
    spread value 1 to Alterable Value A (spawner).[/color]

    then just put in the rest of the events for your code

    did this help you?

  5. #5
    No Products Registered

    Join Date
    Mar 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    No, because I want it to happen no matter how many enemies are on screen.

  6. #6
    No Products Registered

    Join Date
    Feb 2009
    Location
    Texas
    Posts
    825
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    then do this

    [color:#990000]if spawner overlaps screen[/color]
    [color:#663366]spread value 1 to alterable value a (spawner).
    Restrict Actions (how ever many seconds you want the enemies to spawn).[/color]
    this is if you want the spawners to continously spawn enemies.


    [color:#FF0000]if spawner overlaps screen
    flag 1 if off[/color]
    [color:#3333FF]spread value 1 to alterable value a (spwaner).[/color]

    [color:#990000]If Alterable Value A is greater than or equal to one[/color]
    [color:#3333FF]turn flag 0 on.
    Set Alterable Value A to 0[/color]

    [color:#CC0000]If flag 0 is on[/color]
    [color:#000099]create enemy at (wherever you want the enemy to be created)
    turn flag 0 off
    turn flag 1 on
    only one action when event loops[/color]
    this is if you want the spawner to spawn enemies only once.

    did this work?
    if not, then explain to me EXACTLY what you want the spawners to do when they are onscreen

  7. #7
    No Products Registered

    Join Date
    Mar 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    Eh, this is working a little better, but it still has problems.

    Say two enemy spawners are on screen, each one made an enemy. Now both of the enemies go off screen, so both are destroyed. If you go to a point where spawner 1 is off screen and then go back, another enemy should be created. But, since spawner 2 had been on screen the whole time, no enemies are created.

    It needs to check if that spawner's enemy has been destroyed or not.

  8. #8
    No Products Registered

    Join Date
    Feb 2009
    Location
    Texas
    Posts
    825
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    you could do

    [color:#FF0000]if enemy x position of less than the x left visible edge of screen[/color]
    [color:#3366FF]destroy enemy[/color]

    [color:#FF0000]if enemy x position of greater than the x right visible edge of screen[/color]
    [color:#3366FF]destroy enemy[/color]

    [color:#FF0000]if enemy y position of less than the y top visible edge of screen[/color]
    [color:#3366FF]destroy enemy[/color]

    [color:#FF0000]if enemy position of less than the y bottom visible edge of screen[/color]
    [color:#3366FF]destroy enemy[/color]

    you could put all of these into one condition using the or function.

    you could also try doing the events that i said in the previous post, but make it specific to each spawner.

    if this doesnt fix the problem, then tell me what is happening when you run the frame.

  9. #9
    No Products Registered

    Join Date
    Mar 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    Alright, now I've got each spawner to create an enemy when it comes on screen, and I have the enemies set to be destroyed when they go off screen. I set it so that if a specific spawner goes off screen, its flag 1 goes back off (using fastloops and another id).

    However, if I spawn both enemy 1 and enemy 2, then scroll until spawner 2 is off screen, then scroll back until it's on screen, it'll create a third enemy. So I still need it to check if its specific enemy has been destroyed. I only want one enemy from each spawner to exist at any given time.

  10. #10
    No Products Registered

    Join Date
    Dec 2008
    Location
    U.S.
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: multiple instances spawning at multiple places

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=129541&#Post129 541

Page 1 of 2 1 2 LastLast

Similar Threads

  1. How do ya prevent multiple instances of the app running?
    By TheDigitalAlchemist in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 6th October 2012, 01:01 PM
  2. Multiple instances
    By Windybeard in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 23rd January 2012, 01:20 PM
  3. Multiple OINC Instances
    By Tuna in forum Lacewing
    Replies: 31
    Last Post: 20th June 2009, 10:42 PM
  4. Multiple instances of app.
    By Bruto in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 16th April 2008, 04:03 AM
  5. Multiple Instances of Object glitch
    By JimJam in forum File Archive
    Replies: 10
    Last Post: 5th March 2008, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •