Well, I'm making a clone of a game called Tower Defense, and my problem at the moment, is I'm making a map editor for it... All fine and dandy, graphics are loading fine and all. I can display them however I want. Now, my problem, is that when I finally get to have actual people walking on the 'roads', I need the people to follow the road and not go off it.

Is there an inbuilt function in Jedi-SDL to do this, or is there a specific way of doing it? I'm not using any tile system currently in Jedi-SDL, I basically made my own... The background, and the roads, are PNG files, the roads are each 64x64. I basically need to be able to tell the characters to move left, or right, or straight, when the opportunity arises. I also plan on having multiple paths to the end of the map... So I will be building a slightly more complex AI.

My coding is quite simple so far, and only framework to display this:
http://i209.photobucket.com/albums/b...464/stage2.png
is in place.

My coding can be seen here:
http://pastebin.ca/659226

So, to recap, my question is, how do I detect the edge of the png files?


Edit: Also, some information which may be useful, when reading the code:
Code:
Debugging:

Error 1 is a surface error, where a picture is attached to a surface but the surface is equal to nil.

Error 2 is


=======================================

Naming Conventions:
Roads (for blitting, is a pSDL_Surface):
road_(first letter of vertical direction)(first 3 letters of horizontal direction, ie lef or rig)turn
example: road_drigturn (downwards right turn)
in use: sdl_blitsurface(road_drigturn,nil,screen,nil);

Roads (for assigning gfx, the actual url to the file is contained within):
road_(first letter of vertical direction)(first letter of horizontal direction)turn
example: road_drturn (downwards right turn)
in use: road_drigturn := img_load(road_drturn);
As you can see, I have created a skeleton of a debug system, which I am implementing as I go