The Dink Network

Tiles

May 28th 2010, 09:02 AM
anon.gif
toothpaste
Ghost They/Them
 
Just a little question. I'm developing a little dmod where Dink can decorate his house. You guys must know about that 'vision' thing, where sprites shows up only when some variable have a specific value. I used that so you can buy tables, shelfs and chairs. Can the same be done with tiles? That way I could even make a script to choose a floor design.
May 28th 2010, 09:04 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Nope, but you could use different screens and if Dink chooses option 1, he would go to screen one, if he chooses option 2, he would go to screen 2 etc.
May 28th 2010, 09:12 AM
anon.gif
toothpaste
Ghost They/Them
 
No. It would be too much screens. One with table, without chairs and wooden floor. Another without table, with chairs and stone floor etc... I'll just give up on floor design then.
May 28th 2010, 09:21 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
You could just use a sprite with nohit enabled and a depth que of -100. That would behave almost like a tile and could be influenced using visions.

EDIT: 'background' sprites would be drawn below these sprites. So any background sprites should be 'normal' sprites with a depth que of, say, -50 and nohit enabled.
May 28th 2010, 09:23 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Take a screen-shot of the tiles and change them back, then you turn the screen-shots into sprites that you show when a specific variable have a specific value.

EDIT: Aw, Meta, why are you always so fast?

EDIT 2: Who the hell uses background sprites?
May 28th 2010, 09:23 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Toothpaste, there are such things as visions, you know.
May 28th 2010, 09:26 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
I wouldn't use visions for this, instead, have a script that create the items you have when you enter the screen.
May 28th 2010, 09:27 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
Oh, NOW YOU'VE DONE IT! 
There is a command called load_tile(); in which you can drop another bmp file in which is your tileset for something, and then use load_tile() to load another tile set. This could be really useful, but I have never tried it out. Yes, you could use this to change from a stone floor to wooden floorboards and all sorts of things.

I actually considered making a Dink's House Decoration game at one point, but forgot to make it. The best way would not be to use visions, but instead to define some Global Variables such as table, chair, fireplace etc. Then use a script for the screen that checks the values of those Global Variables then draws the sprites to the screen. Just my two cents.
May 28th 2010, 11:44 AM
bonca.gif
Erwin
Peasant He/Him Netherlands
Friendship is magic 
You can use map_tile to change certain tiles in a screen. Here's a full description of map_tile quoted from the DinkC reference.

Category: Tile
Version: 1.08+
Prototype: int map_tile(int tile_position, int tile_index[-1]);

map_tile gets or sets the map tile for the tile at position tile_position.

The tile_position refers to a tile on the current screen. Tile 1 is in the upper left-hand corner, and the position counts left-to-right until Tile 96 at the bottom-right corner.

The tile_index will range from 1 to 4428. tile_index 1 is the tile in the upper-left corner of tileset 1, tile 109 is the tile in the upper-left corner of tileset 2, and so on.

You must use draw_background or draw_screen to show changed tiles.

It is recommended that you either use the map_tile to get the value of a tile you already know, or to create your own function to do the conversion for you:

// get_map_tile_index
// &arg1 = Tileset (1-41)
// &arg2 = Tile X coordinate (1-12)
// &arg3 = Tile Y coordinate (1-9)
void get_map_tile_index()
{
	int &index = 1;

	// Calculate the Tileset offset
	int &temp = &arg1;
	&temp -= 1;
	&temp * 108;
	&index += &temp;

	// Calculate the X offset
	&temp = &arg2;
	&temp -= 1;
	&index += &temp;

	// Calculate the Y offset
	&temp = &arg2;
	&temp -= 1;
	&temp * 12;
	&index += &temp;

	return(&index);
}

May 28th 2010, 01:47 PM
anon.gif
toothpaste
Ghost They/Them
 
Ok. I'll try with map_tile. That covers the entire screen at once with new tiles, if I understood it right, while load_tile covers only one square of the screen. It would be a nightmare putting them one by one in the correct order.
May 28th 2010, 03:33 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
The easiest way is still to just use sprites...
May 28th 2010, 09:33 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
iplaydink said: "Who the hell uses background sprites? "

Erm.... >_>
May 29th 2010, 03:08 AM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
"Who the hell uses background sprites?"

Who doesn't?
May 29th 2010, 03:34 AM
custom_iplaydink.gif
Iplaydink
Peasant He/Him Sweden
Hmm.. 
I'm always using nohit and dephque, and don't see the point of using à background sprite.
May 29th 2010, 03:37 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
People who prefer to use depth que -1 and nohit? It's useless in most cases but preferable near animated tiles.

Just for the record, I do use background sprites.

EDIT: Why is iplaydink so dang fast?
May 29th 2010, 04:27 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Nohit pwns.
May 30th 2010, 04:22 AM
dinkdead.gif
Have you used that, Erwin? I've never got it to do anything whenever I've tried.

And I use background sprites too
May 30th 2010, 04:37 AM
bonca.gif
Erwin
Peasant He/Him Netherlands
Friendship is magic 
Yep. I've used it in Day of the Carcass when Dink got trapped underground. You can see it in action in the teaser at 0:24.

Here's the bit of code I used to change the tiles.

map_tile(25, 5020);
map_tile(26, 5021);
map_tile(37, 5032);
map_tile(38, 5033);
map_tile(49, 5020);
map_tile(50, 5021);
map_tile(61, 5032);
map_tile(62, 5033);
draw_hard_map();
draw_background();
May 30th 2010, 06:41 PM
anon.gif
toothpaste
Ghost They/Them
 
Yep. I've menaged to change tiles. Everything worked. I've tried everything you guys mentioned, and all worked. Background sprites are the easiest way, but I used Erwin's map_tile just to practice scripting. Load_tile is, however, very useful command for other things. Thanks for leting me know about that yeoldetoast. Now, I'm just wondering, I wanted to upload one dmod to this site, but I realised it sucks. Beginners thing, no real story or gameplay. So, I've seen this non-combat contest, and I wonder where do uploaded mods go? I thought every uploaded dmods goes here. I have to create an account for that first, but I won't join in until I have something worth of uploading. I wanna be a real member here.
May 30th 2010, 07:37 PM
dinkdead.gif
Maybe it was load_tile I was thinking of that didn't seem to do anything... I'll have to play about with that a bit. Was probably doing it wrong.

Toothpaste all uploaded stuff gets approved before it's released to everyone, so the contest ones when uploaded will just sit there pending until after they're judged I suppose

Looking forward to seeing your (second) D-Mod
May 31st 2010, 03:35 AM
custom_iplaydink.gif
Iplaydink
Peasant He/Him Sweden
Hmm.. 
Just upload the mod, it wont be the worst one around here!
And most of us have a first dmod that we are ashamed of (includeing me ) but that's just fun, later you can look back and think: 'hey, I've really gotten better at this!'

Looking forward to play it if you your mind, and I hope you do!
May 31st 2010, 01:42 PM
anon.gif
toothpaste
Ghost They/Them
 
Uploading one screen dmod? I'll try to make something a little better.
May 31st 2010, 04:09 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Maybe it would be the worst around here...