Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 My final project, thus far.
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Looking good thus far?
(No ending time set)
Yes.
57%
 57%  [ 8 ]
Yes.
42%
 42%  [ 6 ]
Total Votes : 14

Author Message
Martin




PostPosted: Sun Jun 01, 2003 10:47 am   Post subject: (No subject)

Today I finished movement and my pathfinding algorithm. The pathfinding's really neat, because, for example say that you're in the bottom left corner of the map and you want to get to the top right, it would go left one and down one (Because the entire game is wrappable north/south and east/west)
Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Sun Jun 01, 2003 4:09 pm   Post subject: (No subject)

can it maneuver around obstacles too?
Mazer




PostPosted: Sun Jun 01, 2003 8:17 pm   Post subject: (No subject)

pathfinding? brilliant! clearly you aren't as lazy as i am!

+8 bits, keep it coming!
Martin




PostPosted: Sun Jun 01, 2003 9:00 pm   Post subject: (No subject)

Yeah, it can go around obstacles too. What kind of half-assed programmer do you think I am, eh Catalyst?
Martin




PostPosted: Sun Jun 01, 2003 9:01 pm   Post subject: (No subject)

Don't like bits, eh Mazer?

I can't wait till you post evasive maneuvers... Very Happy
Martin




PostPosted: Sun Jun 01, 2003 9:03 pm   Post subject: (No subject)

Here's the pathfinding, if anyone cares.

code:
loop
  playerx += Rand.Int (-1,1)
  playery += Rand.Int(-1,1)
  exit when playerx = destx and playery = desty
end loop


Lol, just kidding.

code:
    %Procedure to generate a path from (x1,y1) to (x2,y2)
    var smallest : int := 240
    var path : string := ""
    var finalPath : string := ""
    proc generatePath (x1, y1, x2, y2, count : int, movementType : string (1))
        if x1 < 1 then
            generatePath (intMapSize, y1, x2, y2, count, movementType)
            return
        end if
        if x1 > intMapSize then
            generatePath (1, y1, x2, y2, count, movementType)
            return
        end if
        if y1 < 1 then
            generatePath (x1, intMapSize, x2, y2, count, movementType)
            return
        end if
        if y1 > intMapSize then
            generatePath (x1, 1, x2, y2, count, movementType)
            return
        end if
        if count > smallest or count > (2 * intMapSize) then
        elsif strPathMarker (x1, y1) = "m" then
        elsif movementType not= "f" and troopstack (x1, y1).tile < 48 then

        elsif x1 = x2 and y1 = y2 then
            smallest := min (count, smallest)
            if count = smallest then
                finalPath := path
            end if
        elsif strPathMarker (x1, y1) not= "m" then %Tile not marked
            strPathMarker (x1, y1) := "m"
            path += "e"
            generatePath (x1 + 1, y1, x2, y2, count + 1, movementType)
            path := path (1 .. * -1)
            path += "w"
            generatePath (x1 - 1, y1, x2, y2, count + 1, movementType)
            path := path (1 .. * -1)
            path += "n"
            generatePath (x1, y1 + 1, x2, y2, count + 1, movementType)
            path := path (1 .. * -1)
            path += "s"
            generatePath (x1, y1 - 1, x2, y2, count + 1, movementType)
            path := path (1 .. * -1)
        end if
    end generatePath


You can't run it, but when I post the finished version of my game, I'll attach the source files for people to mess around with.
JSBN




PostPosted: Sun Jun 01, 2003 9:46 pm   Post subject: (No subject)

your game is looking pretty sweet. Cant wait to see the full product!
paintball_guy




PostPosted: Sun Jun 01, 2003 11:19 pm   Post subject: coo

that looks wicked d00d, keep it up..
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 23 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: