Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Time Based Modelling

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
sdw Posted - Apr 02 2004 : 8:24:02 PM
While the forums seem active tonight I'd like to see if I can get one of my little problems solved. The problem is that sometimes when I give an object too much speed it will run past a solid obstacle. eg:

There's a 2 dimensional map array, holding tile values and walkable values. When moving an object it checks to make sure that the tile it's moving onto is walkable first, then it will reset its position to that tile. But sometimes the speed is so great that the object's next position may actually pass over an unwalkable tile to another tile adjacent to it. How can I get around this problem?
2   L A T E S T    R E P L I E S    (Newest First)
Spodi Posted - Apr 03 2004 : 12:00:19 AM
I was gonna say exactly what Bryk did. So, for example, if you moved MX pixels with each tile 16 pixels wide:

If MX / 16 > 1 Then
For LoopX = 1 To Int(MX / 16)
If MapTile(LoopX + UserX, UserY).Blocked = True Then Exit sub
Next LoopX
End If

So for the first part, you check if you need to loop through with loopX. The second part gets the amount of tiles to check (rounded down because moving 1.9 tiles still wont be touchign tile 2 unless your game is on acid). The the part in the loop simply just checks if the tile is blocked, and if it is, it exits the sub - no movement takes place.
Brykovian Posted - Apr 02 2004 : 9:55:18 PM
The process you're looking for is called "nearing" ... basically, if you have a situation like you describe, you need to walk through a loop of tiny changes from the position the object started in to where it would end moving at its current speed, and do a collision check at each point in the loop. Obviously, you don't draw it after each tiny position change in the nearing loop -- only use them for the checks.

-Bryk

VBGamer © Go To Top Of Page
This page was generated in 0.09 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.