User Tag List

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

Thread: Duplicate enemy problem

  1. #1
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Ziplock's Avatar
    Join Date
    Oct 2013
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Duplicate enemy problem

    I have a scrolling game in mind with lots of duplicate snakes. These snakes are all going to share the same movement patterns. But if the snakes are constantly moving, they are far from their spawn points by the time the hero is on the screen. If I use spawn triggers to create the snakes, the game only recognizes the one ordered most to front.

    What is the basic way of creating a bunch of snakes, all of which remain dormant until the hero approaches and then kick into motion and attack?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    happygreenfrog's Avatar
    Join Date
    May 2011
    Location
    I.L.T.D.O.I.R (I.L.T.D.O.I.R's Location: The Dimension Of Infinite Recursion)
    Posts
    4,307
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    First off, welcome to the forums! Second off, you're going to need to compare the coordinates of the snake and the player (or the snake and the edges of the screen, which can actually also be done). An example would be the best way to explain it, but I don't have MMF2 on this computer right now. It didn't come with a CD drive. However, I already have an external CD/DVD/Blu-ray drive shipping here that will arrive any day now, so I should be able to make one in a few days.

  3. #3
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Ziplock's Avatar
    Join Date
    Oct 2013
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for superfast response! I tried that:

    if x(snake)-x(hero)<[screenwidth]: make snake move. But it only works for the last duplicated spawn point.

    Sorry for my limited response, but I'm under new user post restrictions.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    happygreenfrog's Avatar
    Join Date
    May 2011
    Location
    I.L.T.D.O.I.R (I.L.T.D.O.I.R's Location: The Dimension Of Infinite Recursion)
    Posts
    4,307
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Ah. Well, in that case, try the ForEach object (downloadable here: http://community.clickteam.com/threads/82853-For-Each-Extension (you'll need to register your copy of MMF2 on the forums first (it doesn't work in the demo version anyway, so, if you only have the demo, you won't be able to use it anyway (there is an alternative method to using the ForEach loop object if you only have the demo)))). Basically, in an always event before the event that you just told me about (if x(snake)-x(hero)<[screenwidth]: make snake move), start a ForEach loop for the snake generators. Then, simply add an extra condition to the event that tests the snakes' positions: On ForEach loop "<insert whatever you named your loop here>" for object snake

    Then it will loop through each copy of the snake spawn point generator, and then perform the action for each individual spawn point (if it's within the right range, of course).

    Again, if you have the demo version of MMF2, then you won't be able to use the ForEach object, so you'll need to do it another way instead (either way, I can't make an example right now, as I've already stated, but, when I can, I'll make one if you don't understand what I'm saying/if you have the demo version (since the alternative is a little more complicated)).

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't seem to access the link to get the object, and the link to the extension here doesn't seem to work either: https://sites.google.com/site/mmf2stuff/Data Is it no longer supported?

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    happygreenfrog's Avatar
    Join Date
    May 2011
    Location
    I.L.T.D.O.I.R (I.L.T.D.O.I.R's Location: The Dimension Of Infinite Recursion)
    Posts
    4,307
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    First off, welcome to the forums! Second off, Clickteam.info (the site that has/had it) has been having difficulties lately. You can't access the link I put up (which has a download link that works, thanks to nivram (a really great user on here, he has a website dedicated to MMF2 examples (and hosting specific files in the event that someone requests that he uploads it and in the event that he has it))) without registering your copy of MMF2 on here, as it was posted in the MMF2 owner's lounge (which requires your register your copy of MMF2 here).

  7. #7
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Ziplock's Avatar
    Join Date
    Oct 2013
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Link worked fine for me, but I still can't get the extension to work. And I don't have a demo version of the game.

    I did figure out another way to work it out, but it's laggy and I'd like to use the extension if that helps.

    Here's what I tried:

    Multiple invisible enemy spawn points throughout the screen and a foreach object off-screen.

    Always: Start ForEach loop "snakespawn" for object(snake-spawnpoint)

    On ForEachLoop "snakespawn" && x(hero)>x(snake-spawnpoint)-[screenwidth]: Create snake & Destroy snake-spawnpoint


    It still only works with the most recently ordered, and even then, they all spawn at once. Do expressions like this filter the objects, even with the foreach extension? I suspect the problem is with the comparing of the values that can't filter the differences in the objects, but I'm not that familiar with MMF2 just yet.

    It works when the hero is set to collide with the spawn point, but that just makes the foreach extension useless for what I'm trying to do.

    Any thoughts on a precise code that basically says:

    Hero is 300 pixels away from spawn point: Create creature at spawn point and destroy spawn point
    Creature exists: Exercise creature behaviors


    ...such that I can just plant these spawn points throughout the frame at will and have a bunch of creatures that work independently?

  8. #8
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Another way is to use the distance formula (easy to find, I reccommend downloading the Snippet Manager which is a sticky on this forum).

    Then do:

    Always - set alt.value A of snake to [distance formula]

    Always - stop snake

    If alt.a < [distance, i.e 100] - start move snake toward player.

    There's also a chase player example somewhere here, I'm sure it's easy to find.

  9. #9
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ziplock View Post
    Link worked fine for me, but I still can't get the extension to work. And I don't have a demo version of the game.

    I did figure out another way to work it out, but it's laggy and I'd like to use the extension if that helps.

    Here's what I tried:

    Multiple invisible enemy spawn points throughout the screen and a foreach object off-screen.

    Always: Start ForEach loop "snakespawn" for object(snake-spawnpoint)

    On ForEachLoop "snakespawn" && x(hero)>x(snake-spawnpoint)-[screenwidth]: Create snake & Destroy snake-spawnpoint


    It still only works with the most recently ordered, and even then, they all spawn at once. Do expressions like this filter the objects, even with the foreach extension? I suspect the problem is with the comparing of the values that can't filter the differences in the objects, but I'm not that familiar with MMF2 just yet.

    It works when the hero is set to collide with the spawn point, but that just makes the foreach extension useless for what I'm trying to do.
    I've only had the Foreach loop object a little while myself, but I think you still need to have a line in here checking if the loopobject's index is equal to something on the snake object itself, don't you? Like Spreadvalue 0 in alt var "A" or something to compare it to?

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2007
    Location
    UK
    Posts
    306
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ziplock View Post
    Hero is 300 pixels away from spawn point: Create creature at spawn point and destroy spawn point
    Creature exists: Exercise creature behaviors
    I don't know if you have considered this, but a really simple way of doing the above is to make an invisible narrow active the same height of the screen. Set the active to not follow the scrolling screen. When your enemy spawn collides with the active, create the enemy at the spawn and then destroy spawn.

    You can place the active just outside the play area so it creates the enemy off screen - or 300 pixels away from the player.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Problem with duplicate enemies matching ID with..
    By DaveC in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 27th July 2011, 11:50 AM
  2. duplicate enemies problem
    By AndyB in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 18th October 2009, 10:54 PM
  3. Problem with picking duplicate objects
    By Simon in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 28th March 2009, 12:41 AM
  4. The Classic Duplicate Problem
    By Ramses in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 31st October 2006, 09:11 PM

Posting Permissions

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