Computer Science Canada Parabola issue |
Author: | jeo77 [ Sun Jan 01, 2006 3:08 pm ] | ||
Post subject: | Parabola issue | ||
Okay, heres the deal, I'm working on an artillery style game, with two tanks on a random terrain, which shoot (turn based) at each other. The player chooses the angle (left and right arrows) and the power (up and down arrows) of the shot. However, to simulate gravity, im using parabolas, which is very hard to do, considering i've only learned how to graph parabolas using the vertex in math. I have a good chunk of it down pat, but it seems the parabola always starts at the wrong height (sometimes even off the screen). I was wondering if anyone could give me a hand with this. (Please note the messyness, im just learning )
|
Author: | Cervantes [ Sun Jan 01, 2006 5:27 pm ] | ||
Post subject: | |||
Why "simulate" gravity using parabolas when you can easily apply the force of gravity to your shell. On the surface of Earth, gravity accelerates us down. We'll say, for your game, that it accelerates everything down at one pixel per (loop execution)^2. (Standard units of acceleration are m/s^2.)
|
Author: | jeo77 [ Sun Jan 01, 2006 10:20 pm ] |
Post subject: | |
wow, thanks, thats much easier, and is working perfectly! 2 Bits for you! |
Author: | Geminias [ Sun Jan 01, 2006 11:36 pm ] |
Post subject: | |
what do bits do? |
Author: | MysticVegeta [ Sun Jan 01, 2006 11:54 pm ] |
Post subject: | |
Frankly, I don't see a purpose but here is always a link to tell you what they do |
Author: | Cervantes [ Mon Jan 02, 2006 9:07 am ] |
Post subject: | |
Ah, jeo77 catches on fast! But there's one thing you didn't realize. Moderator's bits are locked at 1000 (set back to 1000 after each post). I'll give you your 2 bits back. Thanks is all I need. Also, the wiki is a good source of information. |
Author: | Geminias [ Mon Jan 02, 2006 10:12 am ] |
Post subject: | |
lol @ hacker dan. Well heck, remind me not to get bits in the future. That's kind of cruel, having a "currency" but being unable to do anything with it. You should have to contribute to get bits awarded to you, and you shouldn't be allowed to post your own topics and ask questions unless you have bits. That would be a way to force people to share their knowledge, else get none in return. But, that's just my crazy-nobodylikes kind of thoughts. |
Author: | Cervantes [ Mon Jan 02, 2006 10:25 am ] |
Post subject: | |
Geminias wrote: You should have to contribute to get bits awarded to you, and you shouldn't be allowed to post your own topics and ask questions unless you have bits. That would be a way to force people to share their knowledge, else get none in return. But, that's just my crazy-nobodylikes kind of thoughts. So, you are only allowed to post topics if you have bits. So, you have to reply to topics before you can post your own topics. Think what that would do to the people who come here looking for help: they wouldn't be able to post, and probably never would. CompSci.ca growth plummets. Now, let's stop spamming, shall we? |
Author: | jeo77 [ Mon Jan 02, 2006 11:21 pm ] | ||
Post subject: | |||
Thanks again Cervantes, but now I got another question for ya. So far my whole program involves processes, but my 'partner' for this project made a menu screen, with a GUI, which has the whole game fitting into one process. Now normally I'd rip the menu to shreds and do it different () but it's a 2-person project, and this is about all the guy has done (cause he's not really good at it, I don't blame him). So I need to incorperate it into the overall program... Here's the menu part (took sum stuff out, cause it has nothin to do with the actuall programming it self...
The problem is that you can't put a process in a process, so what should I do? |
Author: | Cervantes [ Tue Jan 03, 2006 9:09 am ] | ||
Post subject: | |||
First, you should read about why you should avoid processes. Second, you should consider the possibility of changing the code a bit so as to avoid processes. Third, if you must keep processes, you don't need to define a process within the definition of another. You need to call a process from another. Can you not fork the play_game process from the menu process, if the appropriate conditions are met? I assume the menu contains a "Play Game" type button. Since you're using Turing's GUI, that button requires an action procedure. That procedure should contain the following line (in some manifestation or another):
|