[PLUGIN] Instance GroupForum Home > Construct 2 Development > Plugins for Construct 2
|Post Reply||Page 123 5>|
Topic: [PLUGIN] Instance Group
Posted: 01 Mar 2012 at 9:52am
This plugin contains groups indexed by name. Each group stored instances by UID. The group supports two kinds of data structures:
- set: union,complement,intersection
- list: sorting
In actions of this plugin, you can
- add/remove uid to/from a group
- shuffle a group
- sort by custom function
- pick instances from a group (using uid)
In conditions, you can
- retrieve a group
- test if a uid is in a group
In expressions, you can
- get uid from index (since group is a list)
- get index by uid
When instance destroyed, plugin will remove uid from groups automatically.
Here is an example.
You can sort the group by custom function.
1. Declare sorting function by "Condition: On sorting".
2. In this function, you can get two values from "Expression: CmpUIDA" and "Expression: CmpUIDB", using these two uid to pick up instances and compare them by your rule.
3. Finally, using "Action: Set compared result" to tell plugin which one is larger.
Advance: private group
"Expression: PrivateGroup" can return a special group name formatted by
For example, group "@10$aa","@10$bb" will be destroyed automatically when instance with (uid=10) has been destroyed.
PS. There is a small plugin which can provide "action:pick instance by UID". It can save events.
Edited by rexrainbow - 05 May 2013 at 7:14am
|Post Options Quote Reply Posted: 01 Mar 2012 at 9:20pm|
|Post Options Quote Reply Posted: 02 Mar 2012 at 1:01am|
Sorry, I put wrong image in the first thread. Fix it.
Edited by rexrainbow - 02 Mar 2012 at 1:01am
|Post Options Quote Reply Posted: 02 Mar 2012 at 4:27am|
I was working on a node-based path plugin, but I may just try something with this instead. Thanks!
|Post Options Quote Reply Posted: 02 Mar 2012 at 4:45am|
I made this plugin for storing/retrieving a group of instances in event sheet. It could be an input/output for other plugins.
For example, a kind of "filter" (plugin) will get instances from a (instance) group, do some computing, then put the result in another (instance) group.
So that user could get the result group to do their jobs in event sheet.
I'll need to define an api for this purpose.
Edited by rexrainbow - 02 Mar 2012 at 4:53am
|Post Options Quote Reply Posted: 02 Mar 2012 at 4:55am|
Yes, I see.
I'm still trying to figure out the best way to implement a path (not pathfinding, just path) system. I have started working on a plugin, but I am not sure I can get it to do exactly what I want. I'm also not sure precisely how to implement it, whether it be simply an array of points that also contain information about smoothness of the path there and relative speed adjustments, or something more simple.
I guess ideally I would have a path object with nodes that define the path and how the path is parametrized... I could ask the path for the position at a specific "time" along the path--a parametrized curve.
Sorry, I don't know if any of that ramble made sense, but that is my goal.
Edited by unlikely - 02 Mar 2012 at 4:59am
|Post Options Quote Reply Posted: 02 Mar 2012 at 5:05am|
I made Zigzag behavior before. It used a LOGO-like script to describe a path, like "F 100;R 60".
|Post Options Quote Reply Posted: 02 Mar 2012 at 5:08am|
Ah, yes, that looks fairly close to essentially what I'm after. It's not exactly what would be ideal in my situation, but it will certainly be helpful--I'll check it out. Thank you!
|Post Options Quote Reply Posted: 02 Mar 2012 at 11:48pm|
Nice Plugin rex...
http://dl.dropbox.com/u/44766364/Games/Space2011/index.html Space 2011 (C2 Competition Entry
http://dl.dropbox.com/u/44766364/Games/getin/index.html Get That Ball In (C2 Game)
|Post Options Quote Reply Posted: 03 Mar 2012 at 5:45am|
- Add missing expression description.
- Add "private group" feature to simulate private group of instance. Using "expression: PrivateGroup" to get private group name when getting a group. See the first post for more detail.
Edited by rexrainbow - 03 Mar 2012 at 9:23am
|Post Reply||Page 123 5>|
|Forum Jump||Forum Permissions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum