473,382 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

moving a object

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
7 5162
sicarie
4,677 Expert Mod 4TB
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
uppili
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
uppili
26
can you give some idea to implement the circle with out using the graphic.h
Feb 25 '07 #4
sicarie
4,677 Expert Mod 4TB
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
uppili
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
4,677 Expert Mod 4TB
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
uppili
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

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

Similar topics

3
by: AM Hulshoff | last post by:
Can someone tell me how I can move an object, in this case a listbox, over a form. The code below works, but not when the form is custom sized. It works perfectly when the form is maximized. And...
0
by: Jeff Waskiewicz | last post by:
Here is what I am trying to accomplish. I have an MDI application on the left side of the client area I have a borderless form that holds a treeveiw for navigation. When an item is selected from...
2
by: Diogo Alves - Software Developer | last post by:
Greetings I would like to knowhow can I put a sliding panel... I've done this: if (panel1.Width < 300) { while (panel1.Width < 300) { panel1.Width = panel1.Width + 40;
1
by: =?Utf-8?B?UmljaA==?= | last post by:
In a database search application (vb2005), the user wants to be able to scroll through records using the mousewheel. The data display form contains textboxes for the main data and a datagridview...
1
by: mmalloc | last post by:
I have the following code to move some text with javascript that works both on ie and ff. I can't make it XHTML compatble. If i remove the doctype info it will work. I'm sorry to bother with such...
0
by: Nishanthmarathe | last post by:
Hi There!!! I am new to C# world. I am getting huge chunk of data from a 3rd party applications thru SOAP request and updating to my SQL Server. I cant implement Progress bar as there is no way...
9
by: Peter Webb | last post by:
I want to animate one object moving in front of another. I cannot re-render the background as the object moves, as it would be extremely time consuming. This is what I would like to do. I draw...
0
by: linkswanted | last post by:
We are your trusted source. World Moving & Storage is bonded and licensed by the U.S. Department of Transportation and is one of the largest residential moving and corporate relocation company in...
0
by: linkswanted | last post by:
We are your trusted source. World Moving & Storage is bonded and licensed by the U.S. Department of Transportation and is one of the largest residential moving and corporate relocation company in...
5
by: adarshyam | last post by:
Hi friends, I have an interesting problem in vb.net. And I am struggling to get a solution for this..m trying for the past 3days.. It’s to calculate moving average for the inputs given by the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.