Computer Science Canada Multiple Falling. |
Author: | chrispminis [ Sun Dec 18, 2005 11:49 pm ] | ||
Post subject: | Multiple Falling. | ||
Hey, I need some help. I'm trying to get "coins" to fall from the air. So far I have this.
1. Why doesn't the View.Set have any effect? 2. How would I get it to drop multiple coins at a time instead of just one (I'm trying to get it so that totalcoins is the amount of coins is the max amount of coins on screen)? 3. How would I get the coins to drop at different times (preferably at a manipulatable rate)? You don't have to do the work, but some sample source code so I could see the logic would be great. I can't think of how to do it, although i have been looking through the sources from other programs. |
Author: | Carino [ Mon Dec 19, 2005 3:20 am ] | ||
Post subject: | |||
I got bored, hope this helps.
|
Author: | Albrecd [ Mon Dec 19, 2005 9:44 am ] | ||||
Post subject: | |||||
The View.Set has no effect because it has errors, instead it should be:
In order to have multiple coins at one time, you will need multiple X and Y variables: one for each coin. If you want them to fall at different times, you could do something like:
|
Author: | Albrecd [ Mon Dec 19, 2005 9:47 am ] |
Post subject: | |
Note: the two for loops in the loop in my example could really be one... Why is there no edit button??? |
Author: | do_pete [ Mon Dec 19, 2005 11:59 am ] | ||
Post subject: | |||
try something like this:
|
Author: | Martin [ Mon Dec 19, 2005 7:27 pm ] |
Post subject: | |
Albrecd wrote: Note: the two for loops in the loop in my example could really be one... Why is there no edit button???
No edit button because people would ask for help, get their answer and then they'd edit their post and delete their question. Just post another reply. |
Author: | chrispminis [ Mon Dec 19, 2005 10:44 pm ] |
Post subject: | |
Wow! Thx, a lot of good responses. Can't say I understand it all, but no worries, over the holidays ill teach it to myself. |
Author: | chrispminis [ Tue Dec 20, 2005 10:31 pm ] | ||||
Post subject: | |||||
Ok, Right now im trying to get it so that different coloured coins are worth different amounts of points. Unfortunately I haven't found a place for my
So please debug for me, would be great help. And i used albrects timing idea, and Carinos and do_pete's help with multiple falling (both of your ideas were essentially the same). |
Author: | do_pete [ Wed Dec 21, 2005 11:40 am ] | ||
Post subject: | |||
Here's my above idea modified to do that
|
Author: | Albrecd [ Wed Dec 21, 2005 12:52 pm ] |
Post subject: | |
You need to declare the type of coin at the beginning of the program [i]and[/a] with the code that determines what happens after the coin has finished falling. If you put it in the main loop, it will constantly change, and if you only declare it once, it will keep the same value for the entire program. |
Author: | chrispminis [ Wed Dec 21, 2005 10:35 pm ] |
Post subject: | |
Excellent, thx to do_pete and albrecd, used both of your ideas. Will credit you in comments |