Do Tiles have anything like a Tag field?
Displaying 1-7 of 7 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Alexei

Hello, I'm new and have decided to make a Pacman-style game after playing Pac-Stan. In order to move my monsters, I'm looking to use MoveEntity within a HookRendered function. Something like


void MoveMonsters
{
string directions
string move

for every monster m
{
if(m is not moving)
{
directions = tag of tile monster is standing on
look at directions to see valid directions
move = pick one at random
MoveEntity(m, move)
}
}
}


within the tag would be string like "L4U2D7" and picking a direction at random would involve taking a random part of the string out.

Posted on 2008-08-31 20:55:42 (last edited on 2008-08-31 21:02:11)

Kildorf

I'm afraid not; tiles currently don't have any metadata like that at all. That said, you might be able to fake in a couple of different ways but they would all be horrible.

From my understanding of what you're trying to do, it might be best to just figure out how to calculate what would be stored there. Then you can either calculate whenever you need to know or you could run a pass over the map when it's first loaded, pre-computer everything, and stuff it all in a big look up array for later use.

And I guess, you could also just hand-write the array or something if you really wanted to.

Good luck!

Posted on 2008-09-01 08:38:17

Alexei

Yeah, I just went ahead and coded it. It doesn't look very nice, but never mind. It works and that's the main thing.

It would be a nice thing to add in though, like the same way Entities have description fields.

Posted on 2008-09-01 13:01:49

mcgrue

Actually, this is something specifically on my to-do list for my vacation...

Posted on 2008-09-01 14:19:02

resident

I'm probably missing the point here, but couldn't you just create a two dimensional string array that's the same size as your mazes and then look up the elements depending on the x,y position of the entity?

Posted on 2008-09-05 02:16:11 (last edited on 2008-09-05 02:18:16)

Alexei

That never actually occurred to me! ¬_¬ But wouldn't that have been rather wasteful? Only a very few tiles would have needed the string metadata.

Posted on 2008-09-05 08:06:21

resident

For larger maps on limited systems, it might be impractical. I haven't worked out the memory requirements but I think a high resolution image would probably require more space than an array, unless it's ungodly large.

The array also has the benefit that you can repopulate it for different mazes.

If you were feeling the memory pinch though, I'd imagine you could do something with map zones to record the X/Y positions, so you only need to have as many strings as you need.

I was too lazy to do any of this with Pac-Stan :) I'd intended it as a tutorial game of sorts but I got caught up coding instead of documenting what I was doing about half-way through and I think I actually restructured some of the code after that.

Posted on 2008-09-06 14:27:17 (last edited on 2008-09-06 14:31:06)


Displaying 1-7 of 7 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.