I hope I can describe my problem good. I'm using TGF, and I making a game so when you click a button when the hero (8direction) is overlapping an object, say like a treasure chest or something, but I only want the action to happen if the hero is generally facing that object to interact with.
I managed making a crappy system of making 4 events with the same actions. It's based on the hero's X,Y position and direction facing. But I don't want to make four events with the same action. I have tons of objects to interact with and I want to make just one event for each. Is there a better way, or like an extension I can use. I don't care if you get really complicated with me, I'll take what I can get.
You could have an overlap detector ( a small 2x2 square that sets itself to a position relative to the player depending on the direction i.e top right of the sprite if facing north-east)
and then:
Compare two general values : Direction of Player = Direction of object + 16
+ Detector is overlapping object
= Do something
A shite way that may not work, you could probably do a more effective using a fast loop system. Maybe
Make a detector that sticks out in front of your player a bit. Rotate it (Usually, I use a small circle with a hotspot that's sunk way back away from the graphic; so that you can just tell TGF to set it at 0,0 from the player, and not have to mess around with math.)
Always - Set X,Y of Detector to X,Y or Player
Set Direction of Detector to Direciton of Player
Or you could have it real simple like most RPG games where the chest is always facing south and the hero has to open it looking upwards. Just have the event check to see if the hero and chest collide, as well as if the hero is facing in the up direction. That should work okay.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
@Del - But then your character would be on top of the chest instead of facing it. Keep in mind my idea is best used for a tile based engines; I don't think I actually said that though, so I'll correct it now.
The way I'm doing the chests for Necropolis Rising now is that the actual treasure contents are set on the ground, and then a separate chest active is placed on top of the item. When the necro and the chest collide, the necro's movement stops. Chests can be opened with the Breaklock spell (also how you can open locked doors), which is basically an AoE spell. If the spell's field collides with a chest, it does an opening animation and then gets destroyed, revealing the treasure inside (or underneath, to be more exact). Thankfully I don't have to worry about direction in order to open them. Dragon Quest 8 does make it so you have to be facing the chest in order to open it, but honestly I think it's sort of a minor pain.
One of these days I would like to try a tile based game in MMF. I've done some maps using tiles for the Equin games, and they're basically a set of large double-dimensonal arrays that hold a 3 length long string. Example: O12 = O (for outside), and 12 (12th outside picture, say a tree or something). Does your tile engine use similar arrays to store the information Knudde?
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
By a route obscure and lonely,
Haunted by ill angels only,
Where an Eidolon, named night,
On a black throne reigns upright,
I have reached these lands but newly
From an ultimate dim Thule
From a wild clime that lieth, sublime,
Out of space
Out of time.
By a route obscure and lonely,
Haunted by ill angels only,
Where an Eidolon, named night,
On a black throne reigns upright,
I have reached these lands but newly
From an ultimate dim Thule
From a wild clime that lieth, sublime,
Out of space
Out of time.