Jump to content

I need help with positions!


Recommended Posts

Hello every1!! :)

OK, this is what I have:

If $goldPos[0] > $bluePos[0] And $goldPos[0] < ($bluePos[1] + 32) And $goldPos[1] > ($bluePos[1] + 32) And $goldPos[1] < ($bluePos[1] + 32) Then ToolTip("PRESSED", 2)

That's supposed to make a tooltip on the left side of the screen when I press SPACE and the two 32x32 icons are on top of each other...

The thing doesnt work!! well, it works, but not where I want it to!! o:)

Here are the variables I used:

$goldPos[0] = golden character's LEFT position

$goldPos[1] = golden character's TOP position

$bluePos[0] = blue character's LEFT position

$bluePos[1] = blue character's TOP position

I'm making a fighting game with the yellow and blue dragon cursors in %WINDIR%\Cursors... :lmao:

Thanx!! :)

El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Link to comment
Share on other sites

Hello every1!! :)

OK, this is what I have:

If $goldPos[0] > $bluePos[0] And $goldPos[0] < ($bluePos[1] + 32) And $goldPos[1] > ($bluePos[1] + 32) And $goldPos[1] < ($bluePos[1] + 32) Then ToolTip("PRESSED", 2)

That's supposed to make a tooltip on the left side of the screen when I press SPACE and the two 32x32 icons are on top of each other...

The thing doesnt work!! well, it works, but not where I want it to!! o:)

Here are the variables I used:

$goldPos[0] = golden character's LEFT position

$goldPos[1] = golden character's TOP position

$bluePos[0] = blue character's LEFT position

$bluePos[1] = blue character's TOP position

I'm making a fighting game with the yellow and blue dragon cursors in %WINDIR%\Cursors... :lmao:

Thanx!! :)

<{POST_SNAPBACK}>

This is baisc "hit detection" right?

If Gold intersects Blue we'll fire off a message box.

Well, let's put gold at 0,0 to make this easy. We'll also assume you're using a grid of say....... 8x8 instead of 1x1

Dim $goldPos[2], $bluePos[2]
$goldPos[0] = 0; Gold's X axis
$goldPos[1] = 0; Gold's Y axis
$bluePos[0] = 64; Blue's X axis
$bluePos[1] = 64; Blue's Y axis

While 1
   $bluePos[0] = $bluePos[0]  - 8
   $bluePos[1] = $bluePos[0]  - 8 
   If $bluePos[0] <= $goldPos[0] + 32 or _
      $bluePos[1] <= $goldPos[1] + 32 then
      Tooltip()
      $bailout = 1
      ExitLoop
   Endif
   Sleep(10)
Wend
If $bailout = 1 then Msgbox(0,"Intersect","Intersect at: X: " & $bluePos[0] & _
   " Y: " & $bluePos[1])

This is untested, but it should work without all that complicated AND stuff.

The other solution is to DIM your array into 4 parts. Since gold and blue are a fixed size of 32x32, then your X and Y array would look something like:

Dim $bluePos[4]
$bluePos[0] = 0; Left X 
$bluePos[1] = 0; Top Y
$bluePos[2] = $bluePos[0]  + 32; Right X
$bluePos[3] = $bluePos[1]  + 32; Bottom Y

And check for the intersection of any of those points.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...