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

AdventureWalrus! [CSE] [xlibC]

Started by Unicorn, April 04, 2015, 05:03:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Unicorn

Hmm..

I was using the xlibc spite collision, real(4,6 and I think that will work for me, if I can figure out how to get it to work without nesting it in an If Then End loop.
  • 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

Oh right, I forgot that xLIBC had sprite collision. I never got it to work before (which is why Reuben CSE died). Maybe @tr1p1ea could help since he wrote that part of DCSE but he isn't around often.
  • 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

tr1p1ea

Brief explanation of sprite collision function, it tests for collisions between rectangular coordinates so if you have say a sprite that is:

X = 10
Y = 10
W = 8
H = 8

And you wanted to test if this 'rectangle' overlaps with an enemy sprite at:

X = 15
Y = 15
W = 8
H = 8

Like so:


Then you can use the function to check:

real(4,6,1,10,10,8,8,15,15,8,8

In which case they do collide so the result will be a list:

{1,1,0

{1 = collision found
  1 = number of collisions found
  0 = index of collision passed with real( statement

And since there was only 1 set of coordinates passed the first index that collided is 0 (the red square).

Another case:

Rectangles at:

X = 10
Y = 10
W = 8
H = 8

Tested against others where:

X = 15
Y = 15
W = 8
H = 8

X = 48
Y = 32
W = 16
H = 16

X = 8
Y = 0
W = 64
H = 16

Like so:


The call would be: real(4,6,3,10,10,8,8,15,15,8,8,48,32,16,16,8,0,64,16

And the result would be:

{1,2,0,2

{1 = collision found (would be 0 if no collisions occured)
  2 = number of collisions found (green and red)
  0 = collision with index 0 (red)
  2 = collision with index 2 (green)

Index 1 is the orange square for which there was no collision.

Unicorn

Thanks for that info tr1p1ea! I think that may just make this whole thing work :D
  • 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

Ooh nice tutorial tr1p1ea. I think it should be on the DCS wiki somewhere. :) And glad to hear Unicorn.
  • 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

Unicorn

Yup! I just need to spend time testing and confirming that collision works, then its on to throwing the money :D
  • 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 ??? ??? ??? ??? ???



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

alexgt

Quote from: Unicorn on June 25, 2015, 11:44:08 AM
Yup! I just need to spend time testing and confirming that collision works, then its on to throwing the money :D
And on to convincing my friend to let me borrow his CSE :P
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Unicorn

lol, well sprite collisions not working. So I think I'm not checking the list right, so I'm gonna try to fix that soon. Any good suggestions for commands that check lists? (I always have problems with them) :/
  • 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

I can't help unfortunately, since I myself had to quit Reuben CSE due to issues with collision D:. Maybe you could ask on Cemetech? Or maybe @tr1p1ea could help. You should post the code, though.
  • 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

Unicorn

#114
I'll try to post the code, but its a pain typing it all out :(

EDIT: Current Code, @tr1p1ea can you give me an idea of what I'm doing wrong with sprite collision?


real(0,1,1
real(8,1,0
"MNYWBG
real(5,2,0
"MNSPRT
real(5,0,0
DelVar NDelVar BDelVar K
19→T
randInt(8,19→U
randInt(5,15→V
Repeat K=15
real(2,0,0
Ans→K
T+1→T
U+1→U
V+1→V
If T=20:Then
Lbl 1
randInt(1,130→M
real(4,6,2,M,1,16,16,L,1,16,16,N,1,16,16 //HEre
max(|LXL
IF Ans=2
M+24->M
If Ans=1
Goto 1
real(4,0,M,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
If T≥40:Then
DelVar T
real(7,9,M,1,29,26,93,0
End
If U=20:Then
Lbl 2
randInt(1,130→L
real(4,6,2,L,1,16,16,M,1,16,16,N,1,16,6 //Here
max(|LXL
IF Ans=2
L+24->L
If Ans=2
Goto 2
real(4,0,L,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
If U≥40:Then
DelVar U
real(7,9,L,1,29,26,93,0
End
If V=20:Then
Lbl 3
randInt(1,130→N
real(4,6,2,N,1,16,16,M,1,16,16,L,1,16,16 //Here
max(|LXL
IF Ans=2
N+24->N
If Ans=1
Goto 3
real(4,0,N,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
If V≥40:Then
DelVar V
real(7,9,N,1,29,26,93,0
End
If K=2
P-25→P
If K=3
P+25→P
If K=2 or K=3:Then
"MNYWBG
real(5,1,0
real(5,3,P-25,104,16,16,0,0
real(5,3,P+25,104,16,16,0,0
End
real(4,0,P,104,2,2,0,0,4,0,0,3,4,11,12
End
  • 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 ??? ??? ??? ??? ???



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

tr1p1ea

Im looking into the issue, just wondering what the expected behaviour is?

Unicorn

The sprite x coord (L,M, and N) gets changed up 16 pixels when the collision is found
  • 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 ??? ??? ??? ??? ???



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

tr1p1ea

So this will be between the sprites on the top row?

Unicorn

Yeah, I made a few changes, so there's new code. It still didn't fix it though :( Thanks for looking at it.

real(0,1,1
real(8,1,0
"MNYWBG
real(5,2,0
"MNSPRT
real(5,0,0
DelVar NDelVar BDelVar K
19→T
randInt(8,19→U
randInt(5,15→V
Repeat K=15
real(2,0,0
Ans→K
T+1→T
U+1→U
V+1→V
If T=20:Then
Lbl 1
randInt(1,130→M
real(4,6,2,M,1,16,16,L,1,16,16,N,1,16,16 //HEre
If max(|LXL=2 or max(|LXL=1
Goto 1
real(4,0,M,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
If T≥40:Then
DelVar T
real(7,9,M,1,29,26,93,0
End
If U=20:Then
Lbl 2
randInt(1,130→L
real(4,6,2,L,1,16,16,M,1,16,16,N,1,16,6 //Here
If max(|LXL=2 or max(|LXL=1
Goto 2
real(4,0,L,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
If U≥40:Then
DelVar U
real(7,9,L,1,29,26,93,0
End
If V=20:Then
Lbl 3
randInt(1,130→N
real(4,6,2,N,1,16,16,M,1,16,16,L,1,16,16 //Here
If max(|LXL=2 or max(|LXL=1
Goto 3
real(4,0,N,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
If V≥40:Then
DelVar V
real(7,9,N,1,29,26,93,0
End
If K=2
P-25→P
If K=3
P+25→P
If K=2 or K=3:Then
"MNYWBG
real(5,1,0
real(5,3,P-25,104,16,16,0,0
real(5,3,P+25,104,16,16,0,0
End
real(4,0,P,104,2,2,0,0,4,0,0,3,4,11,12
End
  • 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 ??? ??? ??? ??? ???



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

Unicorn

BIG changes. So I've decided to revamp the game, making it into a kind of gathering game, with occasional enemies and a shop. So sort of like an RPG, but a bit different. ;)

The original game idea seemed a bit boring, hence the change. And I'm going to change sprite sizes, or maybe have the game be full screen, but probably not.
  • 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