The Daily Click ::. Forums ::. Klik Coding Help ::. 32x32 tile monsters, their collision detection and alterable values (mmf2)
 

Post Reply  Post Oekaki 
 

Posted By Message

EleXor



Registered
  21/01/2003
Points
  269
19th June, 2008 at 00:45:46 -

Hey!

I've been trying to think about this one for a longer time now. How can I create detectors etc for monsters, without them tied to each other (example: step on detector -> destroy monster but this destroys EVERY monster).
I could do it with making each monster an invidual active object, with own detectors etc but that would be STUPID and involve lot of copy pasting and I would soon reach the object limit.

So, my movement type for the player character is the following:
right direction (->. + means an event and - means an action.:

+right key pressed
+player alt a = 0 (to ensure he is stopped)
+right det ISN'T overlapping a backdrop
+right det ISN'T overlapping group active (all the active objects, like monsters)
-set player alt a = 1
-set direction to ->

+player alt a = 1
+player alt b < 32
-set player x pos to (x player+2)
-add 2 to player alt b

So, generally, he will move "smoothly" 32 pixels to right, like the early Final Fantasies, but not like the early Ultimas (instant zap to the next tile).

This is how I define monsters and their detectors et cetera.
+start of frame
-destroy monster
-destroy monster det1, 2, 3, 4

+repeat for random(5)+1 times (so this will produce 1-5 monsters)
-create object monster at -32,-32
-create monster det1, det2, det3, det4 at -32,-32
-set monster x to random(1025)/32*32
-set monster y to random(1025)/32*32
-toggle monster flag 0 on (this is kinda like to show the monster is active/created)

+monster flag 0 is on
-set monster det 1 at +32,0 from monster
-set monster det 2 at -32,0 from monster
-set monster det 3 at 0,+32 from monster
-set monster det 4 at 0,-32 from monster

Okay, so:
Now I got my monsters generated with their detectors, but this is the trouble part:
Let's say I want to make some kind of aggro system, so let's say:

+player is overlapping some of monster's detectors
+only one action when event loops
-look at the direction of player
-play scary_monster_sound.wav

When I tested that it didn't care which monster I overlapped, any worked but that's exactly the opposite of what I want. I tried playing around with alterable values, such like giving each monster a random identifier and checking the identifier with player but I only got some strange results.

If you understood what I ment and know a good solution, please let me know.

Also, if you have experience about 32x32 tile games and have a good plan how to make pathfinding for multiple monsters with GRID MOVEMENT tell me!


Sorry about the messy post, haven't slept for 22 hours (tried to figure this all the time )

Edit:
Another question popped up (I've though about this too), how can one add different colors to a list object at the same time? I need it to point out inportant messages, such like:

-welcome plah plah (black)
-plah plah plah (black)
-You have been poisoned! (green)
-A nearby squirrel vomits all over you! (red)

I believe it can be done with different extensions, but if you have a clue, again, please let me know.

Image Edited by the Author.

 
n/a

jbjovi



Registered
  22/07/2007
Points
  41
19th June, 2008 at 13:27:03 -

You should read this read, maybe it will help : http://www.create-games.com/forum_post.asp?id=220717

It was the same problem for me, even if it's in a different situation. Maybe you'll be able to apply the solution to your problem.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
23rd June, 2008 at 17:30:58 -

Actually, it di help me quite a bit, but now I've got yet another problem. I managed FINALLY to get the pathfinder object to behave as I wanted, but it gets kinda frustrating when I'm trying to make it work to copies of the same object. So, if you know how to use pathfinding object with multiple copies of the same active object (and each going own route, not just jumping to the first active) let me know.

 
n/a

jbjovi



Registered
  22/07/2007
Points
  41
24th June, 2008 at 03:37:12 -

You should tell us what you want to do exactly with the path finding object. Never used it personaly, but maybe there's another solution. In my game, for enemies movements, I'm using active objects. When an enemy overlap one of these active object, it does a specific action (go right, go left, jump...). Then the only problem is to place these object on my scene. Don't know if it's a good way to do things like that but don't know an easyer way.

 
n/a

EleXor



Registered
  21/01/2003
Points
  269
24th June, 2008 at 05:36:41 -

What I need is pathfinding for several monsters in a tilebased dungeon basher. The pathfinder is mainly for the monster AI to find the player, and I think it's pretty impossible to do without the pathfinding object. I've figured out how to do it for one monster and it works, but the trouble arises with multiple copies of the monster.
So the basic idea is, player walks to monster radius -> monster aggro -> start pathfinding.
Image
I pretty much copies that one from a pathfinding example I found and modified it to match my needs. I'm using loops to define obstacles.

I cropped that pic badly but it gives a brief view of my events.
My dungeon is rather complex so I don't believe your method would work accurately enough for this case.

Image Edited by the Author.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click