realbasic-games
[Top] [All Lists]

Re: detecting tile collisions (was Re: Pixel Level)

To: realbasic-games at lists dot realsoftware dot com
Subject: Re: detecting tile collisions (was Re: Pixel Level)
From: "Eric Richards" <erockus at juno dot com>
Date: Sat, 18 Dec 2004 20:08:14 GMT
Delivered-to: realbasic-games at lists dot realsoftware dot com
>>Ah. So do I need to change my code keep what I have because what
>>I have right now seems to be working, more or less.

>Yes, I recommend you change your code.

Hmm....
So when you said " when moving up, you really want 
to check points A and B, which are slightly 
higher than the corners  of your sprite.",  -4
is going to be what I want, as shown below ?

  if Keyboard.AsyncKeyDown(&h7E)  then //UP
    Knight.myDirection = "up"
    Knight.frameIndex = ((Knight.FrameIndex+1) mod 3) + 3
    CornerX = (Knight.X-4)// This should be the Top Left
    CornerY = (Knight.y-4)// ...
    CornerCol = (CornerX\32)// And this should be the its Col/Row
    CornerRow = (CornerY\32)// ...
    if TileIDAtColRow(3,CornerCol,CornerRow) > 0  Then
      return
    end if
    CornerX = (Knight.X+32-4)// This should be Top Right
    CornerY = (Knight.y)-4// ...
    CornerCol = (CornerX\32)// And this should be its Col/Row
    CornerRow = (CornerY\32)// ...
    if TileIDAtColRow(3,CornerCol,CornerRow) > 0  Then
      return
    end if
    Knight.y = (Knight.y -6) - Knight.RunSpeed
    return
  END IF

Also I tried -Knight.RunSpeed from the Corner's but the knight
would stop that extra amount away from an object. If I let go of shift then he 
would move close to the object, though I can still move freely.

________________________________________________________________
Juno Gift Certificates
Give the gift of Internet access this holiday season.
http://www.juno.com/give

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>