I really need to get better at making programs before I start making them a surprise. Anyway...


I am working on a Rubik's Cube screensaver. Currently, I have most of it figured out, but I ran into a problem: How do I get each line of cubes to stay the same color, than change it to a different color once I start the next row?

Current code is here:

Code:
ClrHome
ClrDraw:ZStandard:AxesOff:10->V
For(0,100,10
For(A,1,10
   For(B,1,10
      Pxl-On(A+X,B+X,V
   End
End
End


Currently, my color is stored in V.


For anyone that wants it:
http://sc.cemetech.net/?hash=Ix7P62j5YalCem1cdE5KMSbAq2Q/
*Bump*

So... I've run into another problem.

I just need to get the entire side of the Rubik's cube to turn red, with single-pixel spaces between each cube.

Here's a screen shot:


Here's what it looks like once I've turned the side to red:


NOTE: The process does turn it all to red. I just wanted to illustrate the difference between the first loop and the second loop which turns it to red.

Code:


Code:
ClrDraw:ZStandard:AxesOff:10->V
For(X,1,147,49
   For(Y,1,147,49
   For(A,1,48
   For(B,1,48
      Pxl-On(A+X,B+Y,V
   End
   End
End
End
1->B
For(A,1,147
   Pxl-On(A,B,Black
End
1->A
For(X,1,147
   For(Y,1,147,49
      For(B,1,48
         Pxl-On(B+Y,A+X,V+1
      End
   End
End


Please help me. Also, the red has to go from top to bottom. I can't run it any other way, which is why I'm asking for help, as I'm stuck.


EDIT: This is my 555th post. Yay.



Also, this is what happens when SC3 works properly.

The X For( loop needs to have a third argument, the 49. Also, something to think about: Why not use lines instead of pixels, it will go much faster.

Fixed Code:

Code:

ClrDraw:ZStandard:AxesOff:10->V
For(X,1,147,49
   For(Y,1,147,49
   For(A,1,48
   For(B,1,48
      Pxl-On(A+X,B+Y,V
   End
   End
End
End
1->B
For(A,1,147
   Pxl-On(A,B,Black
End
1->A
For(X,1,147,49
   For(Y,1,147,49
      For(B,1,48
         Pxl-On(B+Y,A+X,V+1
      End
   End
End
Yes, but if I do that, they won't draw sequentially like I want them to. My plan is to create a functioning Rubik's cube, and the black line is the corner, as the cube "turns" the red will advance behind it. Adding a 49 increment will not make that work. That's why I don't have it.


But thank you for trying to help me. And I will think about replacing the pixels with lines.

Although I don't think speed will be a problem, as this is being written for the C(S)E.
Caleb_J wrote:
Yes, but if I do that, they won't draw sequentially like I want them to.
What do you mean by this?
What I mean is that as the black line of pixels advance across the screen, I want the red to follow right behind it.


The black line represents the corner, and as it goes across the screen, it will give the illusion that the cube is turning. However, I can only achieve this if the red pixels/lines go across it, right behind it, as it represents another side. That's what I want.
I understand what you're saying, but I don't know if there is an easy way to do so in a singular for( loop. You could try something like this:
Add a for( loop inside the X loop that turns pixels off at X-48. It wouldn't look quite right, because as the cube is turning the amount of pixels in between each column would increase, but I believe that something along the track you're looking at.
A small part of me just died try to make a rubik's cube look 3d on a calculator... If it is turning, then not only does the advancing red need to have changing proportions as it advances (something like X-(50-X), I think I figured that out) but the blue side's proportions in-between columns would change, which would mean redrawing the entire cube, not just the red... and it is pretty slow using the pxl command
I was going to get to all of that, but first, i need to make it look somewhat 3d. I can tend to all of the semantics (like proportions and redrawing the cube) later.


EDIT:




NOTE: The square is not normally fragmented. That's jStified (unfortunately).

Hopefully, this will help everyone understand what I want to do, and the problem I am having.

DankCalc: Thanks for the For( loop idea, I will try that out. I do have an idea about that. It might work. But thanks nevertheless.


UPDATE: Here's the file.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement