Author Topic: Help on hit detection for my AXE parser contest entry  (Read 4002 times)

0 Members and 1 Guest are viewing this topic.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Help on hit detection for my AXE parser contest entry
« on: June 07, 2010, 04:01:56 pm »
OK, Thanks.

Read Topic for Question^^

Here's the code:
Quote
:.Keep in mind I'm skipping a lot of the code
:Repeat K=15 or (L=0
:.(X,Y) is your coordinates and (P,Q) is the bomb's
:If (X-P<16 or (P-X<16)) and (Y=Q
:If (Y-Q<16 or (Q-Y<16)) and (P=X
:0->L
:End:End
:End

For some reason I won't die unless I'm right on top of the bomb when it explodes.

Oh, and i used quote instead of code so the < are underlined.

EDIT:  ugh, I was stupid, put Y-Q=0 and P-X=0 instead of Y=Q and P=X, optimized now.

« Last Edit: June 08, 2010, 03:27:02 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Help on hit detection for my AXE parser contest entry
« Reply #1 on: June 07, 2010, 11:23:53 pm »
You should be fine by asking help, as long as you agree that if you use too much code by other people, it migth affect your originality score

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Help on hit detection for my AXE parser contest entry
« Reply #2 on: June 16, 2010, 01:09:35 am »
I'm a bit confused by what kind of hit detection you're looking for. Do you want it to check to see if the bomb is within 16 pixels horizontally and vertically of the character? Like a square around the character with side length 32?

Or does the fact that this question is more than a week old mean that you already solved the problem, I'm just wondering why nobody ever posted a solution or you never posted to say that you fixed it yourself.
« Last Edit: June 16, 2010, 01:10:31 am by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Help on hit detection for my AXE parser contest entry
« Reply #3 on: June 16, 2010, 01:52:26 am »
It appears to have been solved by himself. I think that might have been the day where there were like 45 active topics so we could easily miss topics. In fact, this weekend I'll probably do like last weekend again to check stuff I might have missed. I am still not used to the high board activity XD

EDIT: Also I think that member is not going to be very active until July 5th, from what I could read in another post somewhere.
« Last Edit: June 16, 2010, 01:54:07 am by DJ Omnimaga »

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Help on hit detection for my AXE parser contest entry
« Reply #4 on: June 16, 2010, 04:15:48 am »
Quote
:If (X-P<16 or (P-X<16)) and (Y=Q
:If (Y-Q<16 or (Q-Y<16)) and (P=X
:0->L
:End:End
Disclaimer: I am not yet a Axe Parser programmer. I will try to not just give away code, instead give you some pointers to fix the problem.

Check if you need " and " logic. It may be the reason why you only loose when you are in the place of the bomb.

I think you don't need signed comparison in "X-P<16 or (P-X<16)" and "Y-Q<16 or (Q-Y<16)" like you are doing.
But if Axe Parser has abs() you can do like in BASIC: abs(X-P)<16. Dunno if it would be optimized but is probably easier for TI-BASIC coders read.
« Last Edit: June 16, 2010, 04:16:40 am by Galandros »
Hobbing in calculator projects.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Help on hit detection for my AXE parser contest entry
« Reply #5 on: June 21, 2010, 05:26:25 pm »
yeah, I solved it myself, I did something stupid with the logic so instead of two separated If statements I did a nested one.

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Help on hit detection for my AXE parser contest entry
« Reply #6 on: June 21, 2010, 11:17:35 pm »
using and/or with Axe as well as </>/<</>> can be a major pain, for the later especially when you deal with negative values. In some cases, you need a lot of parhentesises or you need to separate if statements. Glad you got it fixed, though. Builderboy and SirCmpwn gave me hints on collision detection a few days ago and one day I tried them again, and it took me several hours to get an half-decent engine (which I'm still not 100% satisfied about)