Duplicating objects....

For questions about using Classic.

Post » Thu May 15, 2008 11:26 pm

Finally got my computer back up and running... :?

Before I discovered Construct I was using Gamemaker (just a little) and the RPG Maker series. RPG Maker XP had a very handy feature called "self switches", and I was wondering if Construct has an equivalent function to it.

Basically, if I wanted to make a treasure chest I would have the first page of events be triggered by the action key, and that would turn on self switch "A" (the first switch). Under the page for switch "A" I would put the actions that I want the chest to perform (increase party gold by 500, display message "found 500 gold", change graphic to "chest opened", etc.).

After all that I would turn off switch "A" and turn switch "B" on. Switch "B" would simply display an "Empty" message to prevent you from gaining an infinite amount of gold.

Now, the difference between doing this with regular switches and self switches is that once I finish creating the chest using self switches I can copy and paste as many chests as I want and each of them will be treated as a new, unique item. Normally if you simply copy and paste an object then all of them would open at the same time and they would all be considered one single chest.


Soooo... what I'm wondering is; "Does Construct have an equivalent function to 'self switches'?"

Or, rather...

Is there any way to make an object like a treasure chest and have it possible for you to simply copy and paste new chests that all act the same but are considered new and unique objects?

The "paste clone" command doesn't do what I want...

[url:17sqg3mg]http://www.mediafire.com/?csagmnte034[/url:17sqg3mg]

The .cap is pretty simple, just a character and a treasure chest with some events attached to it. If anybody understands what I'm looking for I would greatly appreciate your help. :)

**I won't be online again until Sunday so if anybody posts between now and then, thank you!**
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Fri May 16, 2008 5:57 am

http://www.mediafire.com/?9xygpzmjngq

Hope that works for now. :)
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Sun May 18, 2008 11:07 pm

Thank you, Jeswen! 8)

*sigh* I won't be able to test it until later tonight when I get home, but I'm crossing my fingers.


Oh, everyone else probably figured it out already but if you want to trigger objects using image points you have to have the name of your image points in quotation marks or it won't work. I realized this oh... I dunno, maybe 15 minutes after I posted the question. :oops:
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Mon May 19, 2008 11:01 pm

Thank you again, Jeswen! That was exactly what I was trying to accomplish. I figured that it had something to do with families, or containers, or grouping...

I have to ask, how did you know that attaching a box to the main character's sprite makes copy and pasted objects work differently than usual? Is that just how most other programs do it, or are you just clever? :mrgreen:

Accuracy is a problem, unfortunately. I didn't have a lot of time to work on it today but its surprisingly tricky to get your character to trigger only one chest at a time when they are lined up in a row.

I'm probably just trying to do it the hard way, though. I have an image point for every direction that the hunter is facing and the chests are set to be triggered if they are overlapped by one of the points. The annoying thing is that the "hit box" (for lack of a better term) also has to be touching the chest for the multiple copies to function individually.

I tried changing the hit box from solid green as you made it to a one pixel-wide cross, and that *almost* works. You can still trigger two chests at the same time if you are standing in exactly the right spot. I'm at work right now so I can't check, but I think I remember a "choose closest object" function? Could have sworn I saw it, at least... if so, that should probably do the trick.

[url:mfwqtmoc]http://www.mediafire.com/?lzjj102x7qy[/url:mfwqtmoc] (the new .cap, complete with some ugly usage of image points... :oops: )

I also tried making the hit box solid and giving it four angles and and image point for each angle like I did with the hunter (and included an "always set hitbox's angle to hunter's angle) and I removed the hunter's image points, hoping that it would be more accurate that way... but for some reason its very selective about where exactly you are standing.

Well, I'll give it some more work tonight and tomorrow before work. This might be useful to someone so if I can get it working properly I'll post the .cap.

-later!
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Tue May 20, 2008 2:04 am

[quote="Caspis Sinclair":14xrxxfo]
I have to ask, how did you know that attaching a box to the main character's sprite makes copy and pasted objects work differently than usual? Is that just how most other programs do it, or are you just clever? :mrgreen: [/quote:14xrxxfo]

The box just gives an additional condition that the chest must meet. In this case, must be touching the box and if it is not, it is ignored.

Here is an updated example that fixes that problem ... almost. :wink: It's still possible to open two if they are less than 1 px between, but maybe that is enough?

http://www.mediafire.com/?xnlic9yybcd
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Wed May 21, 2008 6:17 pm

Lets bring the Hunter closer to the Chests. So its looks a little more natural.
And maybe even a Little more 2.5D.

Also lets try to use "bounding" collission dedection. Animated sprites tend to get stuck due
"pixel" dedection. Bounded is also a faster dedection. And its more a yes/no situation.
Black&White decissions. Easyer to stay out "stuck" situations.

We can not do this with the Hunters bounding box.
(I have no idea yet how to change the size of the boundingbox of a sprite. )

Therefor we make a new object. I named it TheEye. Its bounding box is holding the boundings of the movements.

And mayby thats good practice in general. To move a animated sprite arround, move a simple object and jump the sprite to its position, eventualy angle.

Secondly, because i think its more natural to open a chest only when the Hunter is facing it,
we need another way of dedecting this.
It also solves most of the problems with more chests opening because the Hunters bounding box is kinda big.

To do this i added an object that i called TheKey. It also just jumps to TheEye.

Another side-effect of dooing it all this way is : its so easy to debug. To see what exactly happens with your sprites and there connections. I left both, TheyEye and TheKey visible.
In the finished game both will be set invisible. But till then they are perfect debug instruments.

and here is the .cap

http://www.mediafire.com/?elbmjkmxzen

hoped to help
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Wed May 21, 2008 9:25 pm

Cleansed.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Wed May 21, 2008 10:05 pm

run both caps
and see the differences

in your cap u can still open 2 boxes at the same time (probaly in mine too, but not that easy)
in your cap the hunter moves miles from the boxes when moving horizontal
in your cap you have to force the hunter to make BIG cirkels to get arround the boxes
in your cap it looks super 2d and flat
in your cap i can easly place 3 chests in a way that, althaught there is a way out, the hunter gets very stuck

My only target is to improve .caps and workflows

I am sorry if you take offense, its not intended by me
B
3
S
2
G
4
Posts: 322
Reputation: 2,119

Post » Wed May 21, 2008 11:09 pm

Jeswin and The Instance, to the rescue! 8)

I'll try out the caps when I get home, but I probably won't be able to get any serious work done until this weekend (holidays tend to wreak havok on newspaper deadlines...).

I tried to explain to my boss that I'm learning how to use a program to make games, and that any of my peers would agree that it takes precidence over "real" work, but he wasn't convinced. :roll:

Thank you for the advice as well, Instance. I'm not sure if you can edit bounding boxes in Construct yet but it would be a great addition. When you're facing the front of the chest it would look much better if the top half of your character overlapped it.

Oh, and the sprites are just ripped from RMXP. I'm not all that concerned about how these test games look.

...and no, I take no offense whatsoever. :wink:
B
4
S
2
G
4
Posts: 401
Reputation: 2,302

Post » Thu May 22, 2008 12:34 am

Cleansed.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests