• Axe Q&A 5 5
Currently:  

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

0 Members and 6 Guests are viewing this topic.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Q&A
« Reply #45 on: February 15, 2011, 05:13:47 pm »
bump
anyone knowing the answer on m question?
If you want an example in TI Basic, you can look at the code for "Stack'em Up" in my HGP: http://ourl.ca/4491/142729 ;D

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Axe Q&A
« Reply #46 on: February 17, 2011, 09:42:33 am »
In a game map, if you need a edit the value of a tile on the fly, like a piece being collected, and you want to replace it with the value 00h, would you do

E00->tile  or   [00]->tile

the E represents the hex->dec token.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #47 on: February 17, 2011, 09:43:34 am »
quote from omnomirc:
Quote
...
[07:39:43] <aeTIos> Oh wait you should copy the whole tilemap to a list, Copy(Tilemap, L1-6,length tilemap)
[07:40:29] <aeTIos> and then you can write the new var to it with var->{position in list}
[07:41:13] <aeTIos> I hope that is clear. You have to draw the tilemap from the list, obviously.
...
« Last Edit: February 17, 2011, 09:43:52 am by aeTIos »
I'm not a nerd but I pretend:

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Axe Q&A
« Reply #48 on: February 17, 2011, 09:49:25 am »
quote from omnomirc:
Quote
...
[07:39:43] <aeTIos> Oh wait you should copy the whole tilemap to a list, Copy(Tilemap, L1-6,length tilemap)
[07:40:29] <aeTIos> and then you can write the new var to it with var->{position in list}
[07:41:13] <aeTIos> I hope that is clear. You have to draw the tilemap from the list, obviously.
...


Well, I actually planned on drawing directly from the appvar, using a graphics engine that has sprites for all tiles. And I was hoping to continue to work in hex with the numbers. I am just unsure whether the E token is what I need here.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #49 on: February 17, 2011, 10:46:09 am »
Oops, nah, you can just do that this way: [hex]->tile
I'm not a nerd but I pretend:

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Axe Q&A
« Reply #50 on: February 17, 2011, 10:51:54 am »
ok. cool.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Q&A
« Reply #51 on: February 17, 2011, 11:33:29 am »
That won't work, you'll need to just use regular numbers... (or EHEX)

Tile value -> {Y coord * map width +X coord + pointer to map}

and "pointer to map" needs to be a variable or address like {L1}r or A, not something like GDBXXX
« Last Edit: February 17, 2011, 01:06:09 pm by squidgetx »

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 #52 on: February 17, 2011, 06:50:40 pm »
Oops, nah, you can just do that this way: [hex]->tile

Each time you do that you're adding more data to the end of your program, because every time Axe sees [] when compiling, it adds the data then, not when the program is running. And then you're storing the pointer to the data to a var, instead of the data itself, so it'll act in a completely different way.




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 #53 on: February 17, 2011, 07:45:56 pm »
Is there an updated version of this?
http://ourl.ca/8409/154963

Also, I'm working on a smoothscroller in tandem with Tio.  The 6*6 char is locked in the middle (so (x,y)=45,29)), and the blocks are in 8*8.
What kind of formula would I use to figure out which 8*8 square each corner of the 6*6 sprite?
Variables:
Pointer: E (reads at random from RAM)
Top-left corner: I,J
Offset: N,O

Thanks in advance.
« Last Edit: February 18, 2011, 04:45:11 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #54 on: February 18, 2011, 05:22:09 pm »
Here's the most optimized code I could come up with. Only while finding the top left corner does it fully calculate the position. The other corners reuse previously found values and conditionally add to them as necessary. Note that this will only work with the corner locations being calculated in the order below (although code can exist between calculations), and only for the player being at (45,29) due to optimizations tuned specifically to this coordinate.


Code: [Select]
.Top Left
29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆
.Top Right
Nsub(O00)→r₅+r₆
.Bottom Left
Osub(O00)*[map_width]+r₆→r₆
.Bottom Right
r₅+r₆

Lbl D8
  /2/2/2
Return

Lbl O00
  //2≠⁻2
Return
« Last Edit: February 18, 2011, 07:11:14 pm by Runer112 »

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 #55 on: February 18, 2011, 06:33:56 pm »
And what does it do? Does it store each in r6 one at a time?  How are they recalled?
Vy'o'us pleorsdti thl'e gjaemue

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #56 on: February 18, 2011, 06:40:21 pm »
I use r5 and r6 to avoid having to redo calculations, they're not necessarily the actual results. Each line gives the result for the corner specified in the comment above it, so if you wanted to store the results to a variable for instance, you'd have to add a →VAR to the end of those lines.

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 #57 on: February 18, 2011, 07:00:57 pm »
Ah, ok.  So it returns four pointers...
Just wondering--what would the unoptimized version of this be like?
« Last Edit: February 18, 2011, 07:01:10 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #58 on: February 18, 2011, 07:05:44 pm »
This is effectively what it does, only this is larger and slower.

Code: [Select]
.Top Left
29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Top Right
29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
.Bottom Left
35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Bottom Right
35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
« Last Edit: February 18, 2011, 07:11:02 pm by Runer112 »

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 #59 on: February 18, 2011, 07:08:22 pm »
Quote
...Jsub*[map_width]
What does that do?  I thought sub( called a subroutine, but in the code there's no parenthesis or label pointer...
Vy'o'us pleorsdti thl'e gjaemue