I’ve been trying for a while to figure this out… and after a few nights of no sleep and several full days of vein effort, I think my body is finally giving out on me! =o
At one point I lost the ability to read since I could no longer focus on text, and several hours after that I think I may have suffered a “mini” stroke, a “transient ischemic attack” where half my body went numb… but I didn’t let little things like that keep me down! No sir, I just popped an aspirin and got a little rest and here I am back at it!
But I have concluded - I need help. So, I am here.
I guess I’ll start off by stating what it is that I am trying to do. I’m a bit tired and perhaps a bit sleep deprived, but I’ll try my best to explain:
I’m making a 2D scrolling tile-based game.
Not a side scroller or overhead view, but at a prespective - somewhere in between… so the tiles are twice as long as they are high, and the character moves twice as fast horizontally as they do when moving vertically, and so on and so on… I should also note movement isn’t restricted to moving from the center of one tile to another, it’s “pixel perfect” and such.
Anyway I have it scrolling nice and fine and fast, and I have the character animations & movement speeds fairly good for all eight directions of movement (North, Northeast, East, Southeast, South, Southwest, West, Northwest) and I have it so before moving to a new tile, it will check if the tile is “walkable” or not before moving, and that all works as desired…
…but what I’ve been trying to get working and what I’ve been having strokes over, is to have it so I could set tiles to have a specific area or shape which stops player movement, while the rest of the tile’s area was still traversable - the only way I can limit player movement at the moment is to set whole tile as unwalkable (tile.walkable = false).
What I tried doing was leave the tiles as “walkable” and then adding a movieclip inside the tile’s movieclip called “hit” which was shaped like the area of the tile I wanted to stop player movement… then, when the player was on that tile, or about to walk onto that tile, I tried to have “hit” do a .hitTest(playerclip._x, playerclip._y, true) and if the player was about step inside “hit”, it would stop the player… but I’m having a lot of trouble getting hitTest() to work.
I’m thinking the problem might have to do with localToGlobal/globalToLocal type stuff… or perhaps that, plus the way I have the tiles scroll and character move…
I think I have the movieclips nested something like this:
_root > tiles > tilename
| |--->hit
|
> char
So when I have the character move in a certain direction a certain distance, I make the background scroll and the character appear to stay in the middle of the screen by moving _root.tiles the exactly opposite as I move char.
So anyway, if any of that made sense… that is my dilema (Beside the fact that I just had a stroke of sorts - at age 21 …I’m even in decent shape :h: )
My goal, have only a section of a tile stop movement while the rest is open to move about upon… at very least have it so the tile is divided at an angle, say, from the bottom left corner to the top right corner forming a triangle… like if you divided the rectangle into two triangles - one stops the player the other doesn’t.
I don’t like to bothering other people with my coding problems… though I’m about 95% artist and 5% programmer and could probably use a lot of help… but, if anyone could take it upon themselves to try helping me out - possibly preventing another stroke, thus saving my very life …hehe, I’d sure appreciate it!
And incase anyone was wondering I’m just doing this for fun - not for any sort of personal gain. Yes, oddly enough I seem to enjoy staying awake days on end figuring this kinda stuff out… but it would sure help if I was a programmer and knew enough to actually figure it out! ^___^
I haven’t seen too many really nice, good looking RPGs done in flash, so I just thought I’d try my hand at it.
Anyway, thanks in advance!
~Bel