Results 1 to 6 of 6

Thread: game help!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20

    Question

    im trying to make a rpg but if i
    move the man to a tree how do i
    make the man stop there??

  2. #2
    Lively Member
    Join Date
    Oct 1999
    Posts
    65

    I have the answer.

    You seriously want to know??? Because I have developed flawless collision detection...
    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Depends on how you store the tiles (I wouldn't know how to do it without tiles, so if you aren't using tiles please do ). If you have a 2D map of tiles you draw on the screen you can just look in your map if there's a tree like this:
    Code:
    Public Sub Player.Move(iX as Long, iY as Long)
      'For example if 1 is a tree
      If Map( (Player.x + iX) / TileWidth, (Player.Height + iY) / TileHeight ) <> 1 Then
        'No collision so move
        Player.x = Player.x + iX
        Player.y = Player.x + iY
      End If
    End Sub
    Well, that doesn't work perfectly because you have to set a collision range for the player, but I think you'll get an idea how to do it .

  4. #4
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    Apollo, how do you do your detection, because mine sometimes fails and units get stuck inside each other
    buzzwords are the language of fools

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Hm.. mine is flawless too

  6. #6
    Lively Member
    Join Date
    Oct 1999
    Posts
    65

    Smile Ok it's really untested, but theoretically it is flawless..

    Instead of checking for collision actually on your objects, I check for it a few steps ahead of them, like where they're about to go. And if they try to turn around, I check if there is something anywhere behind them, if not then start moving. I was having the same problem as you Kenny, because I would walk into an object, but get stuck, because the collision flag would be set to true as long as I was inside of the object, so I developed this little idea. It works perfectly for me, and I'm positive it will for you too.

    If anyone wants a visual to represent what I'm saying, then I will provide one. Ya just have 2 ask.
    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width