Switching Objects?

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Is it possible to take one object and have a trigger to switch it with another in the original location?

  • Like a portal?

  • I believe you mean something like:

    Player.X Equal or Greater to 800 --

    -system: creat object objectB at (objectA.X, objectB.Y)

    -objectB destroy/set invisible/whatever

    Is something like that what you mean? (yes, the pseudocode isn't quite accurate, but those abilities are all there). Like when triggered, a floating square gets replaced with a floating circle, right?

  • I think he means something like:

    On button clicked:

    • Object1 spawn Object3
    • Object1 set position to Object2.X, Object2.Y
    • Object2 set position to Object3.X, Object3.Y
    • Destroy Object3

    Object2 and Object1 switch places !

  • I mean I have an object from a JPG, called OBJECT1. Say it is a picture of the word STRONG (in a particular font/style, etc I like). Sits happy on the top of my screen. Can I make it switched with another JPG in OBJECT2? For example, say a health indicator that goes from the words STRONG and changed to WEAK. So, a trigger that changes one object image to another?

  • I would use a frame in the same object rather than make a separate object.

    Just add the frame, and set the animation speed to zero.

    There are actions to change the frame that work with your trigger.

  • Newt, This just uses one object opposed to several, right? I have been reading about those and seen others use them, but I can not find, even in the wiki, a simple example to go by. Do you have one or could point me to the way?

  • I think I figured it out in some fashion. Tinkering more and will reply back some hours later. Falling asleep......

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Heh, as always, I post/reply and then stumble upon a solution accidentally. I was able to get the right click options in the animator working correctly when I realized I needed the single object highlighted, and clicking in the right animator box (top or bottom). Once I figured out the basic for the example I posted about earlier, I went a bit more into it from two frames to six. Here is what I did and you tell me if I did too much or not.

    Now the space ship grabs purple crosses to spell the word "Jesus" on screen. So, got a cross flying down as do the weapon upgrades, health packs, and baddies trying to blow me to kibble 'n bits.

    I have already made six images of the name "JESUS." Image one is all red. Image two, J is green. Three, JE are green. So on until image six where all are green. This is because it was easier to fill in the letters with Microsoft's Paint bucket fill to change one solid color to another in one click. So, I added that OBJECT using image one.

    After playing around, found I clicked the image and selected the Animator tab. I left clicked the default angle. On bottom window, I copied frame 1 five times. Then, with frames 2 to 6, I opened (double clicked) each into the Construct Picture Editor, cleared each, and opened the before mentioned images of different colored letters. So, frame 1-6 match image 1-6.

    Made a GLOBAL VARIABLE called JesusScore, set for 0.

    With tinkering (and without mentioning all the mistakes and guesses), in EVENTS, start of layout sets the first animation frame:

    + System: Start of layout

    -> XAudio2: Autoplay resource "Skillet - Hero (instrumental).wav" (Loop)

    -> JESUS: Set animation frame to 1

    Down in my list, the cross object flies on down (I set all my creation speeds fast to test fast without waiting):

    + System: Every 1500 milliseconds

    -> System: Create object PurpleCross on layer 1 at (random(640), 0)

    Then I add the collision:

    + Hero: On collision between Hero and PurpleCross

    -> System: Add 1 to global variable 'JesusScore'

    -> PurpleCross: Destroy

    And its following subevents:

    + System: Is global variable 'JesusScore' Equal to 1

    -> JESUS: Set animation frame to 2

    + System: Is global variable 'JesusScore' Equal to 2

    -> JESUS: Set animation frame to 3

    + System: Is global variable 'JesusScore' Equal to 3

    -> JESUS: Set animation frame to 4

    + System: Is global variable 'JesusScore' Equal to 4

    -> JESUS: Set animation frame to 5

    + System: Is global variable 'JesusScore' Equal to 5

    -> JESUS: Set animation frame to 6

    Seems to work for me.

    Do I have the basics covered? How does this work out in terms of efficiency?

    Here is the current version of my retro shooter to show what I mean. I removed the baddies and such to remove clutter to just get to the example in hand.

    mediafire.com/file/p2s9x3ljuuuvqtx/frames.exe

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)