How do I know which instance has which IID?

Get help using Construct 2

Post » Sat Feb 09, 2013 8:56 am

[QUOTE=Cowdozer]I watched your Plugin tutorial and it was a nice intro. :) Construct 2 seems very easy to extend that way![/QUOTE]
@Cowdozer
Thanks! Yes, C2's extensibility through plugins is one of its attractive features. I haven't used a regex in any of my plugins, though - yet ;)

@briermay
Another of C2's attractive features is the way in which, as GeometriX says, it will always use the instance of an object that is picked by the condition of an event - without any more work on your part. (Don't be misled by the earlier discussion in this thread, which revolved around a rather esoteric problem.)
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Sat Feb 09, 2013 9:14 pm

GeometriX's example of how to select a clicked instance is good. If you can't open it, though, take this capx. It appears that GeometriX is using the latest beta version, so I just reverted it back to the release version of Construct 2, which you probably have.

https://dl.dropbox.com/u/117529592/Construct%202/Forum%20questions/temp/bluegreen.capx
B
6
Posts: 26
Reputation: 577

Post » Sun Feb 10, 2013 3:25 am

yes I understand that but reason I asked was I have another issue.
I'm doing a multiplayer game I have the server working I have the connection working. upon connection it sends facebook info to the server which then retrieves their profil from MySQL and then will send back a series of indexes.

it would look like
B:0:0:1:0:2:10:3:2 etc (32 pairs in total)
I then need to take the pairs eg 2:10 and set sprite 2's frame to 10

that's the part I can't figure out how to manually "pick" a sprite instance.

I can set an index variable on the sprites instance variables but how to pick the sprite with index 2 then set animation frame to 10 is where I can't find any documentation
B
6
S
1
G
1
Posts: 19
Reputation: 664

Post » Sun Feb 10, 2013 9:40 am

@briermay you should have provided that information up-front. Also, I know you probably don't want to hear this, but perhaps your first game shouldn't necessarily be one with multiplayer features. I suggest that you learn the basics first. At least read through a few more manual entries and tutorials.

Picking nth instance in the manual.

You say you can already read the index and apply it to an instance variable (let's call it varIndex), that's good. From here you'll do something like Pick nth instance (object.varIndex) -> set animation frame (10).
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Sun Feb 10, 2013 8:09 pm

Pick Nth instance
Pick the instance at a given place in the internal list of picked objects. This is most useful used in sub-events to act on separate instances. For example, in a "Sprite collided with Sprite" event, Pick 0th instance and Pick 1st instance can be used to act on each instance involved in the collision separately.

as quoted by the link gives very little detail so I had no idea that was what it was for but thank you.

B
6
S
1
G
1
Posts: 19
Reputation: 664

Post » Sun Feb 10, 2013 8:11 pm

oh and by the way I'm not new to programming been doing it for 14+ years in Perl, c, c++ and some JavaScript just new to construct2 which I'm liking just the manual tends to be a little vague in some areas.

I already have a fully working multi-player server that this connects to using web sockets its just the weird way construct 2 works that I'm getting used to.
B
6
S
1
G
1
Posts: 19
Reputation: 664

Post » Sun Feb 10, 2013 8:25 pm

Nobody is doubting your abilities, but as you said you are new to Construct so expect to spend some time developing your understanding of it and the way it works. Don't neglect the tutorials either.
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Thu Oct 10, 2013 11:45 pm

This thread is probably already dead but It's in the "ball park" of what I have going on in my platform game... I totally agree with briermay in his opinion of the "vagueness" of the manual's explanation on key subjects and features for C2... With that said, I have enemy sprites on the layout... 4 with platform boxes pinned to the graphic... the manual says: "Using the previous example, if there were four TrollEnemy objects in a layout, these are instances of the TrollEnemy object type. There is only one TrollEnemy object type no matter how many instances are created. Instances all share the events and artwork for TrollEnemy. Similarly, there could be multiple instances of the OgreEnemy object type." Ok with that understood, I want my player to destroy each enemy... Individually... How can I achieve this? I've read this section of the manual back and front, and I still can't come with a solution(In C2 logic that is) to solve this problem... Again sorry for the "Thread jacking"..

UPDATE:
I can see that the enemy sprite (e.g. graphic) will be ok during "destroy" part of event, but the platform box attached to each will be gone forever because I do not see a "UID" for said object... Is this the main issue I will encounter on execution? When I run the game, after the first "destroy" sequence the other enemy graphic seem to behave as if the pinned box has been removed and act "wildly" ... Collisions appear to be not functioning properly...BLACKMASK CEO2013-10-11 00:12:56
Image
B
28
S
12
G
9
Posts: 103
Reputation: 7,395

Post » Fri Oct 11, 2013 12:46 am

You can use Containers to tie two objects together. It's great that you are reading the manual, but you should try some of the tutorials also. You can also post a CAPX of what you have so far, and the current problem, and people will be all to happy to help.
ImageImage
B
66
S
19
G
121
Posts: 3,195
Reputation: 72,852

Post » Fri Oct 11, 2013 1:05 am

@blackhornet

Thank you for the reply! I'm assuming Containers are available for use in the "free" version of C2? I'm kinda new to this Editor, but the potential it can unlock is well worth the grind I'm going thru... And yes , I have taken a look at several forum post(s), tutorials and links(provided by Ashley and Kyatric)... A lot of helpful information on all kinds of awesome features, like respawning enemies, high scores tally, and health bar counters... but nothing on my topic of multiply instances(with sprite box pinned; platform behavior attached) all on the layout at system start of layout... I can see the instances all 4 have different UID(s), but the sprite box(platform behavior) all 4 of those "do not" have UID(s) in the properties bar... so that's where I'm stuck at that point... Kyatric's link to "Frequently asked Questions" is a tremendous help... It gives me great ideas for other games I want to fiddle with, but I'd really like to get this problem nipped in the proverbial "bud" so to speak...
Image
B
28
S
12
G
9
Posts: 103
Reputation: 7,395

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Allen T, Radulepy and 13 guests