|
-
Apr 17th, 2000, 12:38 AM
#1
Thread Starter
Junior Member
im trying to make a rpg but if i
move the man to a tree how do i
make the man stop there??
-
Apr 17th, 2000, 10:15 AM
#2
Lively Member
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!"
-
Apr 17th, 2000, 12:14 PM
#3
PowerPoster
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 .
-
Apr 17th, 2000, 04:34 PM
#4
Hyperactive Member
Apollo, how do you do your detection, because mine sometimes fails and units get stuck inside each other 
buzzwords are the language of fools
-
Apr 17th, 2000, 05:39 PM
#5
PowerPoster
Hm.. mine is flawless too
-
Apr 17th, 2000, 10:51 PM
#6
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|