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

0 Members and 2 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #630 on: September 24, 2011, 03:44:48 pm »
Thanks Runer leafiness, it makes perfect sense. I changed it to 12, and then I changed it to 64 (which is quite a lot). However, the player just goes on and on to the left.

I think it's because of the comparisons (signed, unsigned), I just used >> and << on all of them, I did it in a sort of random way. Am I doing it wrong?
« Last Edit: September 24, 2011, 03:49:24 pm by squidgetx »

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Q&A
« Reply #631 on: September 24, 2011, 03:47:48 pm »
What are A,B,C and D? Friction should be applied to H, the x velocity. As in
Code: [Select]
H>>0-(H<<0)->S  //get direction of velocity
If S //if we're moving
H-S->H //decrease velocity by 1 in the opposite direction
End
Code: (slightly optimized) [Select]
H<<0-(H>>0)->S
If
+H->H
End

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 #632 on: September 24, 2011, 03:48:04 pm »
Hm, it could be optimized but bleh.
How are you handling the keypresses?  And what exactly do you mean by "not really working"?


EDIT: hm ninja'd.  offtopic but how does the ninja notifier thing warn you?
« Last Edit: September 24, 2011, 03:48:51 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #633 on: September 24, 2011, 04:41:22 pm »
I don't optimize my code (extremely) because it makes it unreadable (in Axe).

Thanks Michael Leesquidgetx, I was confusing variable names, I managed to fix it, not with your code, but with your idea :D

edit by squid: you sure do have a tendency to mix up names :P
« Last Edit: September 24, 2011, 10:41:20 pm by squidgetx »

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #634 on: September 26, 2011, 10:44:46 pm »
Could someone give me an example of how to store data in a program itself? For example, if I wanted to store the highscore in the program.

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 #635 on: September 26, 2011, 11:03:41 pm »
Could someone give me an example of how to store data in a program itself? For example, if I wanted to store the highscore in the program.
You'll want to read part of this thread, starting in that location.  Good luck. :D

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #636 on: September 27, 2011, 10:53:05 pm »
Thanks, that looks like what I need. Is there any way to do this in pure Axe, and is there any possibility of a "write-back' function in axe?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #637 on: September 27, 2011, 10:58:17 pm »
A far simpler way to use write-back is to compile your program for MirageOS or DoorsCS. This will require that the program be run by a shell that allows easy write-back in the form of you simply modifying data in your running program, and the shell will then write any changes back to the original copy.

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #638 on: September 27, 2011, 11:01:44 pm »
So how would that work? Would I get a pointer to the program, then automagically find where the data is, and then edit it? I think that is what you mean, but some example code would be great.

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 #639 on: September 27, 2011, 11:03:29 pm »
well lets say you have a sprite data:

Code: [Select]
[FFFFFFFFFFFFFFFF]->Pic1
If you wanted to modify the first byte of that data, simply do:

Code: [Select]
1->{Pic1}
And as long as you are in MirageOS or Doors, writeback should be automatic, and that sprite will stay modified :)

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 #640 on: September 27, 2011, 11:04:09 pm »
A far simpler way to use write-back is to compile your program for MirageOS or DoorsCS. This will require that the program be run by a shell that allows easy write-back in the form of you simply modifying data in your running program, and the shell will then write any changes back to the original copy.
Yes, but you can still turn writeback off.  I think it's better to force it. ;)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #641 on: September 27, 2011, 11:05:34 pm »
I don't think you should force write-back. If a user has write-back disabled, they probably have it off for a good reason and would be annoyed if your program ignores that they purposely disabled write-back.
« Last Edit: September 27, 2011, 11:06:59 pm by Runer112 »

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 #642 on: September 27, 2011, 11:19:01 pm »
I don't think you should force write-back. If a user has write-back disabled, they probably have it off for a good reason and would be annoyed if your program ignores that they purposely disabled write-back.
True.  I'm just thinking about the user that doesn't know what the writeback option does and then complains about his game not saving because I've been that person before.

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #643 on: September 28, 2011, 04:23:15 pm »
Is writeback provided by a shell or is it a flag somewhere that the OS uses?
« Last Edit: September 28, 2011, 04:23:36 pm by Freyaday »
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Q&A
« Reply #644 on: September 28, 2011, 04:39:35 pm »
Most shells have an option to enable/disable writeback. I forget about ion. Asm() technically has writeback automatically enabled since in order to run it you have to have it unarchived unless you are using zStart or DCS' homerun hook or something like that.