Author Topic: Simple Axe Questions  (Read 23811 times)

0 Members and 3 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Simple Axe Questions
« on: March 22, 2011, 05:43:37 pm »
I've been working on a few things have the following questions:

1. How to write white text in black background? So if I have Rect(0,96,96,64 and then want to use Text( and make it white over dark background. How can I do it? I can't DrawInv everything by the way.
2. I have 2 pictures (two FFFFFFFFFFFFFFFF Pics) and I want to check collision between them, I have (X,Y) for the upper left corner of one of them and (A,B) for the upper left corner of the other one. How can I make them both stop when they collide with each other. So, if one hits the other, they'll both block, collide and can't move unless if they turn around. Thanks.


Notes: I'm not using the x256 mode (I never use/used it). Thanks

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Simple Axe Questions
« Reply #1 on: March 22, 2011, 05:57:04 pm »
1] Use one of the 'Fix' commands.
Code: [Select]
.TEST
ClrDraw
DrawInv
Fix 3

Text(10,10,"Hello World")
Text(10,20,"More Text")
Dispgraph

Repeat getKey(15)
End

Fix 4
.Don't forget to call Fix 4 to return the text to normal.


2.
If you want to use only the coordinates provided, try measuring the X and Y distance between the two points.  If both distances are less then or equal to 8 (or perhaps 7 or 9, tweaking needed), then you know that they collided.  Making them stop depends on how you implemented your physics.
« Last Edit: March 22, 2011, 05:57:46 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Simple Axe Questions
« Reply #2 on: March 22, 2011, 06:00:15 pm »
Remember, with all the fix commands, though, you should switch it back at the end, otherwise the OS will be messed up. It doesn't matter so much on some, but it does on others.
« Last Edit: March 22, 2011, 06:00:23 pm by willrandship »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Simple Axe Questions
« Reply #3 on: March 22, 2011, 06:07:20 pm »
Concerning the Fix command, thanks but I still have a problem:

Code: [Select]
Fix 3
Text(0,10,"TITLE
Fix 4

The thing is, it's gray on black background :S

Thanks.

EDIT: It's not gray but it's constantly rewriting itself, it's in a loop, but still :S

EDIT 2:
Concerning collision,
I can check their distances, but is their a simpler method, using pxl-Test, etc.?
« Last Edit: March 22, 2011, 06:09:09 pm by Scout »

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Simple Axe Questions
« Reply #4 on: March 22, 2011, 06:11:46 pm »
Concerning the Fix command, thanks but I still have a problem:

Code: [Select]
Fix 3
Text(0,10,"TITLE
Fix 4

The thing is, it's gray on black background :S

Thanks.

EDIT: It's not gray but it's constantly rewriting itself, it's in a loop, but still :S


Did you add 'Fix 5' to the start of the program so that text is drawn to the buffer?  Because if you didn't, it drew to the screen directly, and will probably keep redrawing itself to the screen every time you repeat that command, and that causes flickering/is very slow.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Simple Axe Questions
« Reply #5 on: March 22, 2011, 06:14:40 pm »
@Michael: You're a god.

Code: [Select]
ClrDraw
Fix 5
Repeat getKey(15)
Fix 3
Text(0,0,"TEXT
Fix 2
DispGraph
End
Fix 4

Thanks :)

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: Simple Axe Questions
« Reply #6 on: March 22, 2011, 06:18:00 pm »
@Michael: You're a god.

Code: [Select]
ClrDraw
Fix 5
Repeat getKey(15)
Fix 3
Text(0,0,"TEXT
Fix 2
DispGraph
End
Fix 4

Thanks :)

okay, so you can use multiple Fix commands at once?

also, I find this kinda funny since you're the one who wrote that awesome Fix tutorial.  :P

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 Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Simple Axe Questions
« Reply #7 on: March 22, 2011, 06:23:19 pm »
@Michael: You're a god.

Code: [Select]
ClrDraw
Fix 5
Repeat getKey(15)
Fix 3
Text(0,0,"TEXT
Fix 2
DispGraph
End
Fix 4

Thanks :)

okay, so you can use multiple Fix commands at once?

also, I find this kinda funny since you're the one who wrote that awesome Fix tutorial.  :P

It's fun lol, I forgot about the fixes.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Simple Axe Questions
« Reply #8 on: March 22, 2011, 06:26:53 pm »
How do you shake the screen in Axe?

Or am I being a donk and there's a command for it?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Simple Axe Questions
« Reply #9 on: March 22, 2011, 06:28:09 pm »
How do you shake the screen in Axe?

Or am I being a donk and there's a command for it?

I think you could run a loop through all pixels and move them left (Pxl-On, Pxl-Test) but that sounds too much work, any simpler ideas?

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Simple Axe Questions
« Reply #10 on: March 22, 2011, 06:29:30 pm »
Use a bunch of Horizontal/Vertical commands?

The only bad thing is that the edges will then be pure-white/pure-black, so you'd have to redraw the screen after all the shaking if you were worried about graphics.

I'm also interested in knowing if there's a better way then using Horizontal/Vertical.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Simple Axe Questions
« Reply #11 on: March 22, 2011, 06:30:46 pm »
Use a bunch of Horizontal/Vertical commands?

The only bad thing is that the edges will then be pure-white/pure-black, so you'd have to redraw the screen after all the shaking if you were worried about graphics.

I'm also interested in knowing if there's a better way then using Horizontal/Vertical.

Horizontal -/Vertical- (+, ++, etc) seems way better than my idea as a start.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Simple Axe Questions
« Reply #12 on: March 22, 2011, 06:31:43 pm »
for(...)
horizontal+
dispgraph
Horizontal-
dispgraph
end

like that?

Edit: double ninja'd
« Last Edit: March 22, 2011, 06:32:12 pm by Happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Simple Axe Questions
« Reply #13 on: March 22, 2011, 06:37:24 pm »
The "proper" way to shake the screen is with the z-addressing feature of the display driver. However, Axe does not have a command for this. With a little bit of assembly, I used z-addressing in my otherwise entirely Axe crazy tunnel. You could use z-addressing with something like:
Code: [Select]
Zsub(Z)

Lbl Z
  Asm(147DE63FF640D310)
Return

The input would be taken mod 64 and then applied as the screen's z-address. A z-address of 0 would mean the screen is in its normal state, and for every increase by 1, the screen would be shifted down 1 pixel. Pixels that are shifted off the bottom of the screen wrap around back to the top. This doesn't change the buffer data at all, it just changes how it is mapped to the display.
« Last Edit: March 22, 2011, 06:43:34 pm by Runer112 »

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Simple Axe Questions
« Reply #14 on: March 22, 2011, 06:41:17 pm »
GOD.

I need to learn effin' ASM.

>:\
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm