Author Topic: Axe Q&A  (Read 589612 times)

0 Members and 2 Guests are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Q&A
« Reply #915 on: November 06, 2011, 09:14:09 pm »
2nd+[ANGLE](APPS)>3:r
« Last Edit: November 06, 2011, 09:14:38 pm by Deep Thought »




Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #916 on: November 06, 2011, 09:17:15 pm »
Was that the problem? If not, make sure that you are reading from the appvar, and not from some random place.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Q&A
« Reply #917 on: November 06, 2011, 09:18:59 pm »
He was reading a two-byte number as one byte.

And on that note, remember to store it as a two-byte number too -- VALUE→{POINTER}r




Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #918 on: November 06, 2011, 09:55:36 pm »
So I have two objects, and I'm trying to make one object shoot a projectile at another.  How would one go about that?
(I've been trying to do this all night to no avail :P)
A straight path, or a parabolic one?
Straight.  Trying to not make it too complicated :P
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #919 on: November 06, 2011, 10:12:39 pm »
Is the object you are trying to hit moving?

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #920 on: November 07, 2011, 10:22:11 am »
No, I'm not trying to make it aim ahead.
Just taking the current X,Y coordinates of the shooting object, the current X,Y coordinates of the target, and somehow make the bullet's velocity aim at the target.
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #921 on: November 07, 2011, 02:21:51 pm »
If X,Y is your own position, and C,D is the objects position, and A,B is the velocity of your object:

Code: [Select]
sqrt(abs(X-C)/256^2+(abs(Y-D)/256^2))->L
C-X//L->A
D-Y//L->B

If your position variables are in x256 style.

« Last Edit: November 07, 2011, 06:27:43 pm by Builderboy »

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #922 on: November 07, 2011, 03:41:12 pm »
What does *256 do?  I saw it in a program in the axe documentation but I just ignored it.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #923 on: November 07, 2011, 06:15:57 pm »
Technically, *256 multiplies by 256.  There's some bitwise uses etc iirc but that's pretty advanced :P
When used this way, *256 basically means that for every one pixel on the screen is 256 "virtual pixels" or something.  So, to move an object 1 pixel on the screen you'd have to add 256 to the location variable.
It's normally called inflation, and helps precision stuffs.
(/me isn't good at explaining stuff XD)

So, not-signed division in the first line, and signed in the other two?  Cool, thanks :D
« Last Edit: November 07, 2011, 06:19:17 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #924 on: November 07, 2011, 06:20:42 pm »
Indeed, since square roots only return positive numbers, you only need an unsigned division in the first line ^^

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Q&A
« Reply #925 on: November 07, 2011, 06:25:27 pm »
Well, if your positions are in *256 style, wouldn't their squares overflow? You'd have to divide by 256 before squaring, methinks.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #926 on: November 07, 2011, 06:27:22 pm »
D: That is a good point, i shall modify code now

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #927 on: November 07, 2011, 06:28:47 pm »
So just to clarify (because it's acting odd for me):
X,Y = player location
C,D = target location
A,B = projectile velocity

Also since there isn't a sqrt() token, is that 2nd + x2?

EDIT: wait if there isn't any inflation will it work properly?  In the test program I made there isn't any
« Last Edit: November 07, 2011, 06:30:16 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #928 on: November 07, 2011, 06:32:14 pm »
If there is no inflation, your bullets won't be able to move with enough precision.  Unless, do your bullets have x256 precision and your positions are just in regular x1 precision?

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #929 on: November 07, 2011, 06:38:13 pm »
Before, it was x1.  I'm modding it to work with x256 all around atm to see if I can get it :P
« Last Edit: November 07, 2011, 06:38:39 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue