Join us on Discord!
You can help CodeWalrus stay online by donating here.

[TI-84+CSE] Caticle Chronicles (split from Cat Nipper)

Started by Unicorn, January 05, 2015, 02:24:46 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Dream of Omnimaga

Nah, DrawShape lets you draw pixels of any size, rectangles (filled or not filled), invert parts of the screen, draw circles.


IIRC there is a command to redraw the map in the background when moving a sprite but I never figured out how to use it properly.


DrawShape is considerably faster than Output() and Text(), though. I tried filling the screen with characters using Output() and it takes 1.25 second or so. With a rectangle it takes about 0.25 seconds.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Unicorn

Would it be possible to have the rectangle draw, then move it over, then cover the rectangle with one of different color? (movement)
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Dream of Omnimaga

Yes you can draw stuff on top of each others, but remember to erase the trail behind the moving rectangle.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Unicorn

So I wa lookin at the Doors Cse SDK an this is what I got:

real(9,7,X,Y,10,10,25,1/0

If I add a loop with a getkey that changes the X an Y values, it should move the blue rectangle around the screen right?
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Dream of Omnimaga

You actually got the first two numbers inverted so it would be 7,9 but you get the idea. However a blue trail will be left behind your rectangle so you need to do something about that. For example this:

real(0,1,1 //Half-resolution mode
real(8,1,0 //Mark first half of screen as active drawing space
80->X
60->Y
While 1
real(7,7,X-1,Y-1,12,12,255,0 //white rectangle border
real(7,9,X,Y,10,10,25,0 //blue filled rect
getKey->Z
X-(Z=24)+(Z=26->X
Y-(Z=25)+(Z=34->Y
End


But I would avoid going outside the screen if possible because I don't know if xLIBC supports clipping.

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Unicorn

Ho would I make the rectangle move larger increments using your code? Also, is Drawsprite hard to use? I think I will use the circle drawshape as the asteroids and drawsprite for the player.
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Dream of Omnimaga

Quote from: Cumred_Snektron on February 25, 2015, 08:36:31 AM
Quote from: DJ Omnimaga on February 25, 2015, 06:59:01 AM
getKey->Z
X-(Z=24)+(Z=26->X
Y-(Z=25)+(Z=34->Y

Welp im stealing this trick  ;D
It's actually a very common BASIC trick and I believe there was an even smaller way on TI-BD wiki :P (although it's not necessarily faster). But yeah it can be very handy to get rid of spaghetti code.
Quote from: Unicorn on February 26, 2015, 12:22:59 AM
Ho would I make the rectangle move larger increments using your code? Also, is Drawsprite hard to use? I think I will use the circle drawshape as the asteroids and drawsprite for the player.
If you want to move larger increments then my trick might not work as well. YOu'll need more than a non-filled white rectangle border to erase the sides of the blue rectangle. And for sprites you might need to check DCS tutorials more at such point, because it's definitively trickier.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

CKH4

#68
I use

getKey->Z
X-2(Z=24)+2(Z=26->X
Y-2(Z=25)+2(Z=34->Y


Edit.
You could also use a for( loop to make a smooth transition.

Edit.2

real(0,1,1 //Half-resolution mode
real(8,1,0 //Mark first half of screen as active drawing space
80->X
60->Y
While 1
If Z=24 or Z=25 or Z=26 or Z=34
real(7,9,X,Y,8,8,255,0 //white rectangle
X-8(Z=24)+8(Z=26->X
Y-8(Z=25)+8(Z=34->Y
real(7,9,X,Y,8,8,25,0 //blue filled rect
getKey->Z
End

This is the code for moving 8 spaces without leaving a trail.
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

#69
Ok I found the code, but it actually just checks if an arrow key was pressed, not which one: http://tibasicdev.wikidot.com/max .

:If max(K={24,25,26,34
:<do stuff>


EDIT: Btw CKH4 your code doesn't work. I removed the first End to fix it then fixed the blue rectangle to be the same size as the other. This is what I get:



Ideally you might want to use xLIBC getkey routines, because they allow diagonal movement and quick key repeat, along with faster key detection (although the latter isn't much useful due to how slow BASIC is). But of course its getkey routines require using internal xLIB user variables instead of TI-OS ones, which can be inconvenient in some cases.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

CKH4

Is there any xlib case documentation? I looked but couldn't find anything at all.

Edit.
I forgot the Then. Silly me, too much Axe programming lately.
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

CKH4

Whoops I meant xlib cse. Autocorrect ate my words.
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

Oh OK. The Doors CS wiki is where it's at. http://dcs.cemetech.net . I usually search for xLIBC then in the result I get third-party BASIC libraries (Color) or something like that, and this is where you can get info on how to use the various commands. It isn't that hard to learn the basics, but since every command are basically a bunch of numbers, this can get confusing fast.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Unicorn

Since everyone is so into code today, I need help optimizing.
For my shooting code in Caterite attack,  I did something like this:

Lbl 1
al the movement code
While 1
getkey->M
If M=21
Then
set coords and variables
While 1
C+1->C
Output(D,C,".
If C=3
Goto 1

End
End

I assume there is a way faster way to do this without leaving the While loop and making another one.
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Powered by EzPortal