The shoutbox is currently out of service. Join us on Discord instead.
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.

DJ Omnimaga

It's strange that it would work on the emulator but not the calc. Have you tried archiving your work then doing a RAM clear?

Also I would recommend only moving one walrus per frame (use an extra variable that loops between 1 and 5 to know which walrus in the list needs to be moved around). This should help with the slow cursor movement.

Unicorn

Yeah, the cursor movement was especially slow. But whats really going to happen is 1 or 3 walriis will be on screen for about 2-3 seconds, and then disappear, only to make room for 1-3 more!

Also, what do you mean by your above suggestion? Have only one If Then setup? I can't really get it.



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

DJ Omnimaga

For example, if you had the following code:

Loop
Erase image 1
Update image 1 coordinates
Draw image 1
Erase image 2
Update image 2 coordinates
Draw image 2
Erase image 3
Update image 3 coordinates
Draw image 3
Erase player
Update player coordinates
Draw player
End


You could instead do the following

A = 1
Loop
Erase image A
Update image A coordinates
Draw image A
Increment A by 1 (and reset it to 1 if it's higher than 3)
Update player coordinates
Draw player
End

Unicorn

Ah... I think I see it now, it was hard to imagine in my head

Yup, lets see how this works...




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

Snektron

Quote from: DJ Omnimaga on June 11, 2015, 12:00:19 am
For example, if you had the following code:

Loop
Erase image 1
Update image 1 coordinates
Draw image 1
Erase image 2
Update image 2 coordinates
Draw image 2
Erase image 3
Update image 3 coordinates
Draw image 3
Erase player
Update player coordinates
Draw player
End


You could instead do the following

A = 1
Loop
Erase image A
Update image A coordinates
Draw image A
Increment A by 1 (and reset it to 1 if it's higher than 3)
Update player coordinates
Draw player
End


Theoretically the first is faster though ;) i noticed a huge speed difference when i unrolled some of my asm code O.O
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Unicorn



ClrHome
real(0,1,1
real(8,1,0
"MNYWBG
real(5,2,0
"MNSPRT
real(5,0,0
DelVar NDelVar BDelVar K
Repeat K=45
getKey→K
If T≤10:Then
randInt(1,100→M
real(7,9,M,1,0,29,26,93,0
real(4,0,1,1,3,3,0,0,4,0,0,0,1,2,8,9,10,16,17,18
End
T+1→T
If T≥10:Then
DelVar T
real(7,9,M,1,0,29,26,93,0
End
If K=24
P-16→P
If K=26
P+16→P
If K=24 or K=26:Then
"MNYWBG
real(5,1,0
real(5,3,P-16,104,16,16,0,0
real(5,3,P+16,104,16,16,0,0
End
real(4,0,P,104,2,2,0,0,4,0,0,3,4,11,12
End


So now There are random blue lines everywhere and walrii only displays once. O.O

Any suggestions for that? I haven't had much time to look at it, so please bear with me if its a silly mistake.



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

Unicorn

Well, I dumped it on my calc, and boom! Fuzzy green screen of death. I didn't change a thing. O.O Help me please...



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

alexgt

Screenshot?

That is not good O.O I hope that it works  soon :) As for help from me I don't know CSE Basic/ hybrib basic so no help there :(

Unicorn

Wel CSE basic is the same as 84+ basic, but yeah, hybrid seems tobe effecting it.



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

Snektron

Is in only in your program or everywhere on the calc?

Maybe the fall scrabled your code :trollface:
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


DJ Omnimaga

Seems like you either tried drawing something that is a width or height of zero or tried drawing it outside the screen (although IIRC xLIBC supports clipping). I'M unsure what is causing the blue lines, but I didn't have time to try your code yet.

Unicorn

Hmmm... I bettercheck my rectangles!  Yeah, the blue lines are quite the mystery...



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

Unicorn

June 16, 2015, 06:20:21 pm #102 Last Edit: June 16, 2015, 06:35:07 pm by Unicorn
bump, again

Just recently resent everything to my calc, without changing a thing, and there seems to be corruption. When displaying the sprites, the Walrus becomes white, and the mouse becomes green. I remade the spritesheets, but it still occurs, That led me to the conclusion that my code was the problem. But, I didn't change a think to do with displaying sprites! Any help here?




ClrHome
real(0,1,1
real(8,1,0
"MNYWBG
real(5,2,0
"MNSPRT
real(5,0,0
DelVar NDelVar BDelVar K
19→T
Repeat K=15
real(2,0,0
Ans→K
T+1→T
If T=20:Then
randInt(1,130→M
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 or U≥40 or V≥40:Then
DelVar TDelVar UDelVar V
real(7,9,M,1,29,26,93,0
real(7,9,M,1,29,26,93,0
real(7,9,M,1,29,26,93,0
End
If K=2
P-16→P
If K=3
P+16→P
If K=2 or K=3:Then
"MNYWBG
real(5,1,0
real(5,3,P-16,104,16,16,0,0
real(5,3,P+16,104,16,16,0,0
End
real(4,0,P,104,2,2,0,0,4,0,0,3,4,11,12
End


File: zip

EDIT: All fixed! There was a problem with color offset, even though I didn't call it O.O



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

Unicorn

Bump.

Now, I think I'm gonna have troubles with sprite collision.

How would I check if sprite at A,B with a W/H of 16 meets another at D,C with a W/H of 16?

real(4,6,1,A,B,16,16,C,D,16,16 is what I get. Is that correct? If they do collide, they would return 1 to ans right? To check multiple sprites at once, would I need multiple real(4,6 commands?

Here's the code, if anyone wants to help.


ClrHome
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
randInt(1,130→M
real(4,6,2,M,1,16,16,L,1,16,16,N,1,16,16 //HEre
If Ans=1
M+16→M
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
randInt(1,130→L
real(4,6,2,L,1,16,16,M,1,16,16,N,1,16,6 //Here
If Ans=1
L+16→L
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
randInt(1,130→N
real(4,6,2,N,1,16,16,M,1,16,16,L,1,16,16 //Here
If Ans=1
N+16→N
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



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

DJ Omnimaga

Quote from: Unicorn on June 16, 2015, 06:20:21 pm
bump, again

Just recently resent everything to my calc, without changing a thing, and there seems to be corruption. When displaying the sprites, the Walrus becomes white, and the mouse becomes green. I remade the spritesheets, but it still occurs, That led me to the conclusion that my code was the problem. But, I didn't change a think to do with displaying sprites! Any help here?




ClrHome
real(0,1,1
real(8,1,0
"MNYWBG
real(5,2,0
"MNSPRT
real(5,0,0
DelVar NDelVar BDelVar K
19→T
Repeat K=15
real(2,0,0
Ans→K
T+1→T
If T=20:Then
randInt(1,130→M
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 or U≥40 or V≥40:Then
DelVar TDelVar UDelVar V
real(7,9,M,1,29,26,93,0
real(7,9,M,1,29,26,93,0
real(7,9,M,1,29,26,93,0
End
If K=2
P-16→P
If K=3
P+16→P
If K=2 or K=3:Then
"MNYWBG
real(5,1,0
real(5,3,P-16,104,16,16,0,0
real(5,3,P+16,104,16,16,0,0
End
real(4,0,P,104,2,2,0,0,4,0,0,3,4,11,12
End


File: zip

EDIT: All fixed! There was a problem with color offset, even though I didn't call it O.O
That might explain some of the issues I sometimes had with First Fantasy development. I resorted to setting the color offset to zero manually at the game start.

As for your other issues, I can't really help now as I am too tired, but I'll check later I think. I am unsure how collision can be done with such layout, maybe using a matrix grid or something?

Powered by EzPortal