The Daily Click ::. Forums ::. Klik Coding Help ::. A level editor problem part 2
 

Post Reply  Post Oekaki 
 

Posted By Message

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
4th January, 2009 at 21:17:28 -

Hi guys! I'm making a level editor for my game and I wondered if there are any "Global events" like, for making my life easyer. BEcause you see, I want both tiles and tilesets to be image files which can be loaded, and, since I thought this was impossible I soon encountered my next problem. I tried to forget the image files and just used actives, but then i need to have like, 3 events for each tile! I'm already familiar with the array object so this is the part that is bugging me. Please help me out guys. Thanks in advance.

 
Professional vaporware developer

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
4th January, 2009 at 21:43:43 -

http://www.create-games.com/download.asp?id=7422

Is this answer to your questions?

 
I have proven new mathematic formula to be true...

2D > 3D

Image


Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
4th January, 2009 at 22:15:55 -

Oh god NO! I wanna learn it, don't get away with some cheap solution!

 
Professional vaporware developer

easyname



Registered
  15/04/2008
Points
  450
5th January, 2009 at 07:32:37 -

By Global, do you mean applies to every object?

If so, I think you could use qualifiers or behaviours to make that work.

They can both be set in the objects properties, and behaviours act as an objects own event sheet.

 
n/a

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
5th January, 2009 at 20:46:59 -

Yes i do mean that it applies to all the tiles. I am familiar about both behaviours and "groups" or "qualifiers". I dont think just knowing that solves my problem lol



 
Professional vaporware developer

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
6th January, 2009 at 13:15:08 -

You're being vague about what your problem is, that's why you aren't getting the answer you want.

 
n/a

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
6th January, 2009 at 20:25:57 -

Seriously. I don't want to freaken program each and every tile! I would also like to be able to load tiles from image files but still be able to "Paste them into background" on the load of the array to save some runtime 'n' stuff.

 
Professional vaporware developer

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
7th January, 2009 at 02:01:14 -

From what I guess, even if you can code a level editor to just copy and paste tiles from a tilesheet, you will encounter a problem saving the level where it has no idea what those tiles are, it's just a heap of pictures pasted onto the screen. Therefore, every tile needs a value and to be saved as a value in an INI or array and then once again loaded with that value so the program can automatically paste those tiles from the set itself to load the level. Then you have the problem of telling MMF what values each tile carries so that it can save and load it accordingly through events, and I'm not sure with an image file that will be a simple task. (The program needs to distinguish each tile from eachother) but I think some of the genius coders around here would have an idea of how to do it efficiently.

Using actives, you may well have to use a few events for each tile. Alternatively, set all of their alt. values to subsequent values, (1,2,3,4..etc) and have the event editor recognise them through these when writing to your level file instead of saying "What object is it? If it's that object, then write this value." you might get away with "When a tile is placed, write value [Alt. value A of selected object] to slot." Haven't done this myself so I can't say if it's going to work as well. I'm sure it can be done though.

It will pay off to find a way to simply program all of them in a few events rather than 3 events duplicated for 100 tiles (300 events!).

Concerning custom tilesets and tiles, I'm not sure.

Hope my few lines of thought help.

 
n/a

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
9th January, 2009 at 11:31:26 -

Thank you very much dude!! Just hoping that some of those geniuses (like pixelthief lol) gets in here...



 
Professional vaporware developer

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
9th January, 2009 at 11:31:28 -

Thank you very much dude!! Just hoping that some of those geniuses (like pixelthief lol) gets in here...



 
Professional vaporware developer

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
9th January, 2009 at 16:23:35 -

Text blitter is ideal, but is very complicated. I advise try using the Active Picture object; use the command 'Get Picture' to tell it to load a new image, that image being your whole tileset. You can retrieve one in your folder using the expression:
"$Apppath + /TileSetName.png"

now you've loaded your tileset into the picture. You need to have an Array Object which has the data for each tile at each location on your grid, this is something you create in a level editor. You load this object in the same manner, and then run a loop like this:

Always:
Start "X" for (Horizontal Size / 32) Loops

On Loop "X":
Start "Y" for (Vertical Size / 32) Loops

On Loop "Y":
Here, use the ability on the Active Picture object called 'Add Backdrop'
Add Backdrop: At location (LoopIndex("X") * 32, LoopIndex("Y") * 32), with tile value (get value from array), width & height 32


thus the loop will go through each square of your level, and for each spot, it will chop a square out of the image in your active picture object, and add it as a backdrop at that location, creating a finished image in the end. The act of creating the array object that has all your level data is a bit more complicated, you'll need to create some sort of level editor. I'd advise seeing examples for that

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
9th January, 2009 at 16:49:48 -

Thank you Pixelthief mate! Exactly what I needed... I DO know how to write values and such in the editor, (thus i know how to make one) but how do I chop squares out of the picture then? Well probably the same consept anyway...

 
Professional vaporware developer

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
9th January, 2009 at 17:23:11 -

when you use the function, it will ask you for the "X & Y" value of the source; these are the location in the picture object that it takes the tile from. So if your tiles are arranged in a big rectangle, like this:

Image (forgive me nifflas)

then you can store the X & Y coordinates of the tile as a single variable in your array. For example, I use the format: X + (100 * Y), so that at runtime, I can find the proper tile in my spritesheet as:

X = (ArrayValue mod 100) * 32
Y = int(ArrayValue / 100) * 32

Then, it takes the rectangle at these coordinates using the same width & height

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Knockturnal

Nothing to see here turn back

Registered
  11/04/2008
Points
  354

VIP Member
9th January, 2009 at 19:41:11 -

God I love you man (In a very heterophil way! I'm not gayh, lol. )

Edited by Knockturnal

 
Professional vaporware developer
   

Post Reply



 



Advertisement

Worth A Click