The Daily Click ::. Forums ::. Klik Coding Help ::. Distinguishing object instances in the level editor
 

Post Reply  Post Oekaki 
 

Posted By Message

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
27th June, 2011 at 23:38:37 -

I've just been wondering idly, is there a neat way to distinguish individual instances of an object entirely through the level editor? Like if you wanted to link doors and remote switches by tagging them with a common alterable value, for example. It's terribly easy if you make your own level editor, of course, but does anyone have a tasty hack otherwise?

I find it sort of off-putting nowadays that I can't help feeling any halfway advanced project is gonna need its own level editor, largely because using the same game engine across frames is an arse and always has been, though I'd love to be proven wrong on that count... Anyway I digress, what do you reckon?

 
n/a

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
28th June, 2011 at 00:05:45 -

Image

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
28th June, 2011 at 02:14:16 -

I *always* make a custom level editor.
They're really very easy to make, they make level creation much easier and quicker (the time saved when making levels outweighs the time spent creating the editor), they can significantly reduce the filesize of your finished game, they can be distributed with your game to allow players to create their own levels, etc...

The alternative is to use temporary tag objects.
For example, you have 3 doors and 3 switches. You create 3 different "tag" objects, with alterable values 1-3, and give them all the same qualifier.
You place one overlapping each door.
You create another of each, and place these overlapping the corresponding switches.
Now, at the start of the frame, you set the value of each door/switch to the value of the tag which overlaps it, and then destroy the tag.

That's probably a bad example - you may as well have just used 3 different types of door object and given them all a common qualifier (and the same with the switches).

This method is far more useful when you have more values to set.
For example, you might have many "soldier" objects, but you want to give them different weapons, armour, items, etc.
You could have three different tags - "spear", "shield", and "50 gold". Combine these with default values (let's say "sword", "no shield", and "no gold"), and you can easily have many different varieties of soldier.

Edited by Sketchy

 
n/a

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
28th June, 2011 at 11:19:25 -

Yeah, that's not a bad method. Maybe you could make a single tagging object and stack an equal quantity on top of each associated door and switch... Maybe that'd be trickier to count than it sounds, I'm not sure.

I'm not sure why this has only just occured to me, but spread values use the order the objects were created in, right? Regardless of whether they were created at runtime or in the level editor. I bet that's hard to screw up in a"doors and switches" scenario.

Could also make an editor of sorts for those particular entities' tags alone...


I *always* make a custom level editor.
They're really very easy to make, they make level creation much easier and quicker (the time saved when making levels outweighs the time spent creating the editor), they can significantly reduce the filesize of your finished game, they can be distributed with your game to allow players to create their own levels, etc...



Yeah. I've actually got half an editor ready for this project, but it's Flash (so slightly trickier) and will only have about 5 frames, so I dunno.

Anyway ta Sketchy!

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
28th June, 2011 at 12:45:57 -


Originally Posted by Duncan
I'm not sure why this has only just occured to me, but spread values use the order the objects were created in, right? Regardless of whether they were created at runtime or in the level editor. I bet that's hard to screw up in a"doors and switches" scenario.



Yes and no.
For objects created at runtime, spread values use the order in which the objects were created.
For objects created in the frame editor, spread values use the display order of the objects (the frontmost object being assigned the value you spread).
You can use order -> bring to front / send to back, and that will change the values assigned to objects (changing the order at runtime doesn't work).

Using spread values is fine, provided you have exactly one switch per door.
Your idea of stacking tags is pretty neat, and should be quite simple - something like this:

+ start of frame
-> run fastloop "Tag", Noobjects("Tag") times

+ on loop "Tag"
+ pick one Tag at random
+ Tag is overlapping Qualifier(door/switch)
-> Qualifier: Add 1 to ID#
-> Tag: Destroy

 
n/a

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
28th June, 2011 at 16:45:05 -


Originally Posted by Sketchy


Yes and no.
For objects created at runtime, spread values use the order in which the objects were created.
For objects created in the frame editor, spread values use the display order of the objects (the frontmost object being assigned the value you spread).
You can use order -> bring to front / send to back, and that will change the values assigned to objects (changing the order at runtime doesn't work).



Ah, that's news to me, thanks!

Still a way away from implementing any of this, if I do at all, but one of these methods should definitely do the trick... I'll post again if I have any more ideas

 
n/a
   

Post Reply



 



Advertisement

Worth A Click