Char-mapped Walls & Edittime

Get help using Construct 2

Post » Mon Feb 18, 2013 9:40 am

Hi guys,

I'm starting off a project, and I thought that I'd start with a helper plugin for my level builds, i.e. a char-mapped wall system that calculates junctions based on proximity to other similar walls in a grid.

I have 2 main problems:

1) I need 16 images per wall type to function for all permutations of North, South, East, West connected or nor connected. I note that I can't just set up 16 image properties, because there is only one editor, so for this I used animations as an image bank. Clearly using 16 named animations will allow me to animate walls too, woo!

The only problem is, that I can't display the walls as they would appear in runtime (when I've written it), because GetTexture only returns the first frame of the first texture (or am I missing something?).

If I can select the texture of a named animation in edittime, that would be amazing - can anyone help with this?

2) I haven't written any runtime code yet, but it looks as though I can get an array of all instances based on my plugin. Can this be done in edittime too? At the moment, I have declared an array, and I add references to all my instances in it when an IDEInstance is created, this works although I just realised that I haven't handled deletion yet.

It seems to me that the IDE must hold a list of all of the instances, is this accessabile from the edittime code? I'd rather not reinvent if it's there anyway.

Cheers,

Mark
B
1
Posts: 4
Reputation: 233

Post » Tue Feb 19, 2013 3:17 am

1. If you have the different walls set up as animations, you can use set frame to change which wall you display and compare frame to find out which one is being displayed:

https://www.scirra.com/manual/115/sprite

2. Instances have a uid (unique id) and iid (instance id, which changes as instances are created and destroyed) that you can query e.g. Sprite_name.uid. (According to the manual, instance ids are "lazily assigned" ^^)

https://www.scirra.com/manual/30/instances
B
7
Posts: 38
Reputation: 476

Post » Wed Feb 20, 2013 1:09 pm

Hi Mike,

I have now written the runtime portion of my plugin (not optimized) and I have certainly been able to use the data in "this.type.animations" to render the cells that I require, I've also been able to use "this.type.instances" to iterate over all of my instances.

Can I ask for some clarification, because I can't get those functions to work in the IDE from edittime.js.

I'm happy with the results I have thus far, but I would love to get the edittime rendering to match what is possible in runtime i.e. access animation frame data to change the texture of the next quad rendered in the IDE.

Cheers,

Mark
B
1
Posts: 4
Reputation: 233


Return to How do I....?

Who is online

Users browsing this forum: Justin1967, qaisarehman and 33 guests