Switching Objects?

For questions about using Classic.

Post » Mon Oct 10, 2011 8:44 pm

Is it possible to take one object and have a trigger to switch it with another in the original location?
B
5
S
1
G
1
Posts: 157
Reputation: 1,219

Post » Mon Oct 10, 2011 9:33 pm

Like a portal?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon Oct 10, 2011 11:29 pm

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?
B
90
S
32
G
14
Posts: 935
Reputation: 14,540

Post » Mon Oct 10, 2011 11:32 pm

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 !
B
6
S
1
G
1
Posts: 69
Reputation: 1,019

Post » Mon Oct 10, 2011 11:54 pm

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?
B
5
S
1
G
1
Posts: 157
Reputation: 1,219

Post » Tue Oct 11, 2011 12:38 am

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.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Tue Oct 11, 2011 5:53 am

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?
B
5
S
1
G
1
Posts: 157
Reputation: 1,219

Post » Tue Oct 11, 2011 7:00 am

I think I figured it out in some fashion. Tinkering more and will reply back some hours later. Falling asleep......
B
5
S
1
G
1
Posts: 157
Reputation: 1,219

Post » Tue Oct 11, 2011 4:21 pm

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.
http://www.mediafire.com/file/p2s9x3ljuuuvqtx/frames.exe
B
5
S
1
G
1
Posts: 157
Reputation: 1,219


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests