Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: guy6020665 on August 27, 2011, 05:27:18 pm
-
So I'm working on a level editor for a platformer that I am currently working on, and I can't use the built in line command because if i did use it, the way I programmed it would cause it to overlap places it shouldn't overlap. Help please? I'm using 0.5.3 by the way, haven't been able to update in a while.
-
Why don't you try Bresenham's line algorithm, but use pxl-change instead of pxl-on? I wrote a subroutine in Axe that does that, you can have it if you want it. I'll upload it as soon as I can, if you want.
-
I don't understand why the default line drawer would not work, could you please explain? Do you need to just have a line drawer that toggles pixels rather than sets them?
-
I don't understand why the default line drawer would not work, could you please explain? Do you need to just have a line drawer that toggles pixels rather than sets them?
Yes, I think that's it.
Anyways, here's the subroutine:
Lbl LN
r3-r1->A
r4-r2->B
r1*256->C
r2*256->G
If abs(A)>abs(B)
abs(A)->Z
Else
abs(B)->Z
End
Repeat r1=r3 or r2=r4 or getkey(15)
A*256//Z+C->C
B*256//Z+G->G
pxl-change(C//256,G//256)
End
Return
I'm 95% sure this will work. You'll probably want to look through it yourself.
The routine accepts four arguments, called like so: sub(LN,X1,Y1,X2,Y2) ; and the function draws a line between (X1,Y1) and (X2,Y2)
-
Thanks. I'll give it a try.
-
Yep. Let me know how it turns out.
-
I haven't yet had time to try the code you gave me yet but i am uploading my current version of the game. After lvl 3 the screen will clear and leave only the person, just hit clear to exit. I'm also planning on adding Jumping code and moving platforms. (run no-stub) It's also currently unnamed.
-
So I'm working on a level editor for a platformer that I am currently working on, and I can't use the built in line command because if i did use it, the way I programmed it would cause it to overlap places it shouldn't overlap. Help please? I'm using 0.5.3 by the way, haven't been able to update in a while.
Hm, shouldn't that be just a change in from an OR to a XOR in the Axe line routine? I'm not sure if Axe's line routine is included in the documentation, but if it is, then that'd almost certainly be the best way to go.
-
So I'm working on a level editor for a platformer that I am currently working on, and I can't use the built in line command because if i did use it, the way I programmed it would cause it to overlap places it shouldn't overlap. Help please? I'm using 0.5.3 by the way, haven't been able to update in a while.
Hm, shouldn't that be just a change in from an OR to a XOR in the Axe line routine? I'm not sure if Axe's line routine is included in the documentation, but if it is, then that'd almost certainly be the best way to go.
Qwerty.55 is right
XOR would turn black pixels white, while OR would leave them black, as 1 XOR 1 is 0
-
This would be an extremely easy Axiom to make since the routine is already written, you could just change a couple or's to xor's like others have been saying. In fact its so easy, I just did it right now in 5 minutes. Here you go, just include #Axiom(XLINE) and the syntax is DrawL(x1,y1,x2,y2) to make an inverted line. Enjoy! ;D
-
By the way the game seems interesting so far. I'm curious how this will turn out. Also I'm glad you're still around and programming guy602665.
-
This would be an extremely easy Axiom to make since the routine is already written, you could just change a couple or's to xor's like others have been saying. In fact its so easy, I just did it right now in 5 minutes. Here you go, just include #Axiom(XLINE) and the syntax is DrawL(x1,y1,x2,y2) to make an inverted line. Enjoy! ;D
Wow that easy?
Thanks ;D
By the way the game seems interesting so far. I'm curious how this will turn out. Also I'm glad you're still around and programming guy602665.
Thanks DJ. I kind of stopped programming for a while because I was overloaded with school work, then when school started we went on a trip to visit practically all my family members, but now I'm back! :)
EDIT: Just wondering, will this work on the back buffer too?
-
EDIT: Just wondering, will this work on the back buffer too?
It should, but I'm no Axe expert
EDIT: Wow, wasn't even thinking about the Axiom posted. I was still referring to the code above.
-
EDIT: Just wondering, will this work on the back buffer too?
The one I posted is only a routine for the front buffer, but I can add a 5 argument version if you need that functionality.
-
That would be great.
Also, is DrawL a token or do i manually type it in?
-
I'm sure it's a token, but the question is, which TI-OS token does it replace?
-
I've searched through the catalog but I didn't find anything.