User Tag List

Results 1 to 9 of 9

Thread: create an object - naming that object

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    create an object - naming that object

    Hi guys-

    Was wondering with the create an object event, if there was a way to name that new object upon creating it, so I can refer to it later?

    Currently, if I have a loop set up to create an object multiple times, I don't have any way to refer to them individually. It's essentially duplicating the object, when what I really want, is to clone it.

    If any further explanation is necessary, please ask

  2. #2
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what exactly i'm looking for is something like this:

    Random number generator is set up to a global value at start of frame. Lets call Global Value Variable "A".
    Run a loop with a cleared array "A" amount of times, incrementing the array value until it hits "A".
    During this loop, create a new instance of a Mob.


    ---------

    Later on in code: Mob2 dies. Destroy Mob2, but leave Mob1, Mob3, Mob4 intact.

  3. #3
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You can't create new unique objects at runtime (how would you write the events to deal with them?). What you can always do is set alterable values either always with spread value or upon creating the object, and then using object selection you can select specific instances or groups of instances that way.
    Working as fast as I can on Fusion 3

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you LB

    I think I can use this but I have never tried.

    Question: I now have a random number of "Goblin" objects on my stage, and the spread of alterable values have been set (meaning the first goblins alterable value A is 1, the seconds alterable value A is 2, etc depending on which random number was cast).

    How can I now refer to each of their positions? Let's say I wanted to do a simple task of moving the 2nd goblin. How would I write the condition/event of moving that particular instance without it affecting all of the rest?

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess my question is, what do you mean by "object selection"

  6. #6
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    You would have to create another active objectand set an alterable value based on the max number of objects you want to reference. So if there is 20 goblins and you want to reference a particular one you would then set an alterable value of another object and match it. The conditions you use then will reference only the one that matches your 'checking active'.

    Example:
    Goblins (Active)
    Checker (Active)
    String (To Display Selected Goblin Position)

    + Spread value 0 through Goblins.

    + User presses 'Space: Set Alterable Value A("Checker Active") to 1+Random(NObjects( "playership2" ))

    The conditions you reference after that just have to include the checker:
    Compare Two Values:
    Alterable Value A ("Goblin") = Alterable Value A ("Checker") DO Change Alterable String: "X: "+Str$(X("Goblin"))+" Y: "+Str$(Y("Goblin"))

    This will then update the text string with the selected goblin. Alternatively, you could just use a Global Value instead of another active.
    Want to learn Clickteam Fusion 2.5?




  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In layman's words Danny, you're referring to a placeholder?

    I've conjured up several of these placeholders right now, and currently they are "working" so far. We'll see how far I get before I"m stumped again :p

  8. #8
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)

    Thumbs up

    I made you this just for reference; not sure whether you need it or not. I'll place it in the archive also.

    Code:
    Object Selection (Fast Loop/Spread Value(id)/Assign Name)
    goblins.mfa
    Want to learn Clickteam Fusion 2.5?




  9. #9
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is great Danny!

Similar Threads

  1. Launch or Create Object actually creates two of the object, not just one.
    By LemonyLime in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 30th June 2017, 09:46 PM
  2. [BUG] Create object if flag is off, and assign something to the created object
    By Popcorn in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 24th January 2013, 11:01 PM
  3. Create Object + Object Selection Revisited
    By Crash86 in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 22nd February 2011, 04:33 PM
  4. Create object at same position of object destroyed
    By The Thinker in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 6th November 2006, 12:16 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
  •