Could someone give me an explanation on how to move sprites left and right and at a different level? Here's a better explanation. So if you split the calculator screen in to 4 sections. And there a 3 sprites, sprite A, B, and C.

Code:
|---------------------------------|
|                      1          |
|---------------------------------|
|                      2          |
|---------------------------------|
|                      3          |
|---------------------------------|
|                                 |
|---------------------------------|

How would you make it so that sprite A will move left and right continuously unless it is hit by sprite C. Then how would you make it so that after sprite A is hit by sprite C, it will spawn again randomly in section 1, 2, or 3. Also after, how do you make it so that the sprite that moves left and right will also change into either sprite A or sprite B after it is hit by sprite C. I know in TI-BASIC that you could simply use rand int commands but I have no idea how you would do that in C. Thanks to anyone who helps me with this. Please feel free to ask any questions because I'm sure it's probably hard to understand what I'm trying to say. Thanks.

-TheGeekyScientist

That table didn't turn out very well. Here's another.
http://imgur.com/g4x6qAq

edit: Table fixed and post merged by Alex
In C:


Code:
int x = randInt(0,10);


Just like in basic. Have you gone through any of the examples yet and learned how they all work?

Also, to change the sprites; just change the pointer to the sprite.
Well I haven't gone through any c examples but I know how to do it in basic. It's hard to find examples in other programs because most are in asm or don't have the source code included.
When you downloaded the C toolchain, it should have come with a folder called "examples". Take a guess what there are about 30 of in there.

If you want to look at a much larger example project instead, I would recommend examining oiram, MateoC's Super Mario World clone.
I completely forgot about that. Thanks so much. I will be sure to take a look at those, maybe they can help me out. Once again thanks... (and to Mateo for creating the C toolchain).
  
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