The Daily Click ::. Forums ::. Klik Coding Help ::. ANOYING! Object association, ID's and stuff =(
 

Post Reply  Post Oekaki 
 

Posted By Message

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
8th March, 2011 at 14:03:09 -

To be fair, i'm pretty good at making level editors... and i have made plenty before. BUT i always come against this problem at some point.
I like to use seperate (external) graphics with objects that you can place on the screen in the level editor, like, when you want to place a start position object it creates a little 16x16 active object with all the data that needs to go along with it, and an ID, it also creates a object graphic using the active picture object. The object graphic also has an ID and there is a loop always running to keep the same ID graphic to the object.

The problem mainly comes when trying to delete them, if you right click it deletes the object and the graphic.. but this really screws everything up.. and the last object you created loses its graphic or somthing.. So I ended making it not delete the graphic and just moving it of the screen and setting its ID to 99999 or somthing... But i'm still getting problems.

Could anyone shed some light on the proper or best way to do this? help is greatly apprecciated

 
dont make me divide by zero...

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
8th March, 2011 at 14:57:35 -

Im not sure whats actually the problem.
But it's probably the loop, make sure you respread values after deleting the object, or actually better before each loop.
Also i find the best way to actually connect two objects is to use fixed value instead two IDs.
Aswell,make sure you take a bath whilst smoking a pipe. It always helps me with serious bugs like these.

 
Code me a sausage!

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1832

VIP Member
8th March, 2011 at 15:29:53 -

It sounds like you keep every tile as an active object, and then when the user clicks save, you write everything to an array at once?

The way I make level editors, is to have them immediately write to the array as soon as anything changes. I only ever have one tile object, and just paste (add) that into the backdrop many tiles.
eg. If the user clicks to add a grass tile, I immediately delete the existing created backdrop at that position, paste the new backdrop, and write "grass" to the array.

If your game isn't tile-based it could be a bit more tricky though...

 
n/a
   

Post Reply



 



Advertisement

Worth A Click