http://calcg.org/newlogo2.png Not Logged in.
Login | Register

General Discussion Board \ Calculator Programming \ code trouble

Click here to log in (you must be logged in to post comments).

AuthorComment
gulyman
Goliath
avatar
Posted: 29 May 2007
19:10 GMT
Total Posts: 144
I made this screen saver in class.It is supposed to slowly fill in a box shape then slowly empty it pixel by pixel. For some reason it will turn the first pixel in the uper left of the box on jump to the rirst column on the left, where it shouldn't be, and start a line going right. The next lines will stay in the box.
This is for the 83 Plus

PROGRAM:THING
ClrDraw
0->Xmin
94->Xmax
0->Ymin
62->Ymax
25->X
35->Y
While 1
ClrDraw
Pxl-Change(X,Y
1+Y->Y
If Y=55:1+X->X
If X=35:24->X
If Y=55:34->Y
End


banjo2E
Wraith
avatar
Posted: 30 May 2007
05:50 GMT
Total Posts: 689
Your problem is that you're using a Pixel command instead of a Point command. Also, if you ever want the box to empty, I suggest using Pt-Change instead of Pt-On (or Pxl-Change, if you refuse to change from Pxl-On)

---
http://uncyclopedia.org/wiki/User:Administrator <------ WOOOOO!!!!!
haveacalc
Guardian
avatar
Posted: 30 May 2007
05:55 GMT
Total Posts: 1111
If you choose to use Pxl instead of Pnt, you don't need to bother messing with window settings. Even then, you've set both 0 and 63 to the Ymin, whereas the correct choices would be 0 for the Ymin and 62 for Ymax. Additionally, remember that true conditions are equal to 1. That means that you could shorten "If Y=55:X+1->X" to "X+(Y=55->X".

---
-quoted directly from most movies that don't exist (and some that do).
banjo2E
Wraith
avatar
Posted: 30 May 2007
09:13 GMT
Total Posts: 689
Wow. I think you 0|/\||\|3|) me almost three-quarters as fast as Chuck Norris.

---
http://uncyclopedia.org/wiki/User:Administrator <------ WOOOOO!!!!!
haveacalc
Guardian
avatar
Posted: 30 May 2007
10:05 GMT
Total Posts: 1111
It was actually directed at gulyman, but all the same. =)

I still haven't typed that prog in yet, but I can tell from looking at it that ClrDraw shouldn't be in the loop. Also, it would be a good idea to change the pixel-turner to Pxl-Change if you want it to keep changing forever and ever. I haven't tested (simple enough that I don't need to), but this should work even better for what you want to do:

ClrDraw
Repeat getKey
For(Y,34,54
For(X,24,34
Pxl-Change(Y,X
End
End


---
-quoted directly from most movies that don't exist (and some that do).
banjo2E
Wraith
avatar
Posted: 30 May 2007
11:07 GMT
Total Posts: 689
Does the For loop add one to each value by default? Cooool. That'll help bundles.


By the way, is there any way to rapidly do a Pxl-Change affecting the entire screen in BASIC?

---
http://uncyclopedia.org/wiki/User:Administrator <------ WOOOOO!!!!!
haveacalc
Guardian
avatar
Posted: 30 May 2007
11:23 GMT
Total Posts: 1111
Slower, more useful screen inverter:
For(A,0,62
For(B,0,94
Pxl-Change(A,B
End
End

Faster. If you look at it for a while, you see the LCD patterns.
AxesOff
FnOff
PlotsOff
ClrDraw
For(A,Ymin,Ymax,(delta)Y ;from [VARS] menu
Horizontal A
End
StorePic 1
Repeat 0
ClrDraw
RecallPic 1
End


---
-quoted directly from most movies that don't exist (and some that do).
gulyman
Goliath
avatar
Posted: 30 May 2007
11:32 GMT
Total Posts: 144
@haveacalc The top program you listed fills in whole lines at a time. I was trying to make one that filled in the box one pixle at a time. And for some reason the bar doesn't have a margin between the top of the screen and itself.
haveacalc
Guardian
avatar
Posted: 30 May 2007
12:29 GMT
Total Posts: 1111
Are you looking at the very first code example (before the other two)? It might just be going too fast for you to tell. You can slow it down like this:
ClrDraw
Repeat getKey
For(A,34,54
For(B,24,34
Pxl-Change(A,B
rand(3 ;higher number for more delay
End
End


---
-quoted directly from most movies that don't exist (and some that do).
gulyman
Goliath
avatar
Posted: 30 May 2007
13:14 GMT
Total Posts: 144
oh ok. but the bar still starts at the edge of the screen, instead of in the middle...ish
haveacalc
Guardian
avatar
Posted: 30 May 2007
13:41 GMT
Total Posts: 1111
I edited that last post of mine to use A and B instead of X and Y. Does that fix it? You might want to mess around with the rectangle numbers; those probably don't draw too prettily.

---
-quoted directly from most movies that don't exist (and some that do).
gulyman
Goliath
avatar
Posted: 31 May 2007
07:44 GMT
Total Posts: 144
Ok I'll try that
haveacalc
Guardian
avatar
Posted: 31 May 2007
13:04 GMT
Total Posts: 1111
Did it work?

---
-quoted directly from most movies that don't exist (and some that do).
gulyman
Goliath
avatar
Posted: 2 Jun 2007
12:45 GMT
Total Posts: 144
As soon as I changed the Y variable to B it worked perfectly. That is really weird. I guess that on the gragh screen the Y variable has some special signifigance.
banjo2E
Wraith
avatar
Posted: 3 Jun 2007
11:28 GMT
Total Posts: 689
I wish I knew whether that was sarcasm or not.

---
http://uncyclopedia.org/wiki/User:Administrator <------ WOOOOO!!!!!
haveacalc
Guardian
avatar
Posted: 3 Jun 2007
12:20 GMT
Total Posts: 1111
Yes, the OS has full reign over Y when you're on the graph screen.

---
-quoted directly from most movies that don't exist (and some that do).





Portal | My Account | Register | Lost Password or Username | TOS | Disclaimer | Help | Site Search | File Archives Copyright © 2002-2019 CalcG.org