By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

moving a object

P: 26
hi friends

i am writing a code for a game. i used graphics.h. in the game we can draw the circle or other easily. i have to move the object at a time so i use for loop with two condition, it was successfully don.

Then after i used key interface to one object and other is in for loop. After running the code i saw only for loop but not key board interface. then after i found that no two code will be run at a time.

[HTML]Q1. is it possible to draw the fig like circle or other with out using graphics.h?

Q2. how i want to run two code at a time[/HTML]


pls suggest me some idea.
Feb 23 '07 #1
Share this Question
Share on Google+
7 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
hi friends

i am writing a code for a game. i used graphics.h. in the game we can draw the circle or other easily. i have to move the object at a time so i use for loop with two condition, it was successfully don.

Then after i used key interface to one object and other is in for loop. After running the code i saw only for loop but not key board interface. then after i found that no two code will be run at a time.

[HTML]Q1. is it possible to draw the fig like circle or other with out using graphics.h?

Q2. how i want to run two code at a time[/HTML]


pls suggest me some idea.
I'm sure that you could implement or recreate what is in graphics.h yourself, but it would probably take some time.

What do you mean by "run two code at a time"? Two programs, two threads? Or are you trying to manipulate two circle objects at the same time?
Feb 23 '07 #2

P: 26
Mr.sicarie.

thank you for your help.

I created a object just like a tank. i make it move from one side to another side of the screen. then i created another object just opp to previous object and i moved two object just using for loop
for(i=0,j=500;i<500,j>10;i++,j--)
here one move form 0 to 500 and another move form 500 to 0.
then i given key bored interface fop one object and another is for loop. the program compile but when i was running the program only for loop is running but not key object.
so i don"t know how to over come this problem.
Feb 25 '07 #3

P: 26
can you give some idea to implement the circle with out using the graphic.h
Feb 25 '07 #4

sicarie
Expert Mod 2.5K+
P: 4,677
Mr.sicarie.

thank you for your help.

I created a object just like a tank. i make it move from one side to another side of the screen. then i created another object just opp to previous object and i moved two object just using for loop
for(i=0,j=500;i<500,j>10;i++,j--)
here one move form 0 to 500 and another move form 500 to 0.
then i given key bored interface fop one object and another is for loop. the program compile but when i was running the program only for loop is running but not key object.
so i don"t know how to over come this problem.
In your code, both i and j are going to be the same number (initially), so that means while i is counting up, j is likewise the number that should be subtracted from 500. So you could do this:

for (int i =0; i < 500; i++) {
j = 500-i;
doStuff.twiddleThumbs();
}
Feb 26 '07 #5

P: 26
thank you sir.
i thing the value of i and j will carry same concept in your code and my code.


[HTML]doStuff.twiddleThumbs(); can you explain this code pls[/HTML]
Feb 26 '07 #6

sicarie
Expert Mod 2.5K+
P: 4,677
thank you sir.
i thing the value of i and j will carry same concept in your code and my code.


[HTML]doStuff.twiddleThumbs(); can you explain this code pls[/HTML]
That was just an example of something being done in the loop - you would insert your own code there.
Feb 26 '07 #7

P: 26
Mr. sicarie


thank you for your help.

now the problem is not a moving a object ok.

i have move by key. and another by own though i call function it will execute step by step
Feb 27 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.