i have that shooting game with angles and velocity and collision detectio in it too . but it seems that it has some problems in it.
for example when i hit the target with an angle of 80 degrees and a power of 104, the bullet just goes through it and nothing happens ( but because i hit it something has to happen ! ) . but when i have the same angle ( 80 ) and now a power of 105, it its the target and detects collision and does the assigned event .
what's wrong with this !! it seems so weird and crazy ! please see the program along with its code and notify me what and where the error is and how can i fix it .
thank you very very much !
The problem with this code, is that it is moving to many pixels a time....so on it way down it's moving something like 40pixels a time. That means that it is possible for it to "jump over" the object you are shooting at....look at my picture to see the movement of your circle...
So the only way to fix this things is to move the object less but update the movement faster
You can do this in many ways. Probably isn't the timer control the best solution, but it's a nice start...
Or you could draw a line from the first position to the second and si if that line colides with anything and if it doesn't you draw your ball at the new position.
Just don't ask how to do it, 'cuz I don't know
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
Originally posted by McCain Or you could draw a line from the first position to the second and si if that line colides with anything and if it doesn't you draw your ball at the new position.
Just don't ask how to do it, 'cuz I don't know
If you had looked at his "game" you would see that that would be difficult...because his circle is not going in a straight line, so that would be more job then necessary...
And BTW you don't want a line on the screen every time anything moves in your game....and an other thing is that with a simple line you don't have the opportunity to check for left and "right" property...so it would be more difficult to check if it really did hit something...
thanks for the nice explanation and the cool picture . i found out what my error is but i didn't exactly get how to fix it !! can you explain the fing part a bit more ( maybe a code )
thankyou very much !
OK...look at this example...it has no collision detection...but it's using the GetTickCount API to time the movement. And I have done so t (time) is updated with only 1/10sec every time, so it don't move that much every time, but it moves a lot more often...
Originally posted by mikesmith6486 sorry , miss typing , i meant the fixxing part . i did not get it how to fix it !!! what property should i change .
thank you
I thought that was what you meant so I did an example...download my last example from my last post and see if you can get it....
wooooooooooooo!!!!!!!!!!
the program goes weird ?
why?
any suggestions?
you mentioned the pixels in the earlier posts . you said it was something like 40 and they missed the shape . can i decrease the pixels some how ? in that case it has to work !!!
thnakyou
Originally posted by mikesmith6486 wooooooooooooo!!!!!!!!!!
the program goes weird ?
why?
any suggestions?
you mentioned the pixels in the earlier posts . you said it was something like 40 and they missed the shape . can i decrease the pixels some how ? in that case it has to work !!!
thnakyou
What do you mean by that your program foes weird???
What I said about 40 (was just a fictive number) is that it doesn’t move like the sun on the sky. It moves a little bit, then it is drawn on the screen...then it is moved a little bit...then it is drawn to the screen.....So if you change the t (time) it will update it self more often or less often...by setting it to 0.1 (double) then every time it is drawn to the screen it has moved less then if time was 1....this is physics and you just have to understand the formula to get this...
And BTW you don't want a line on the screen every time anything moves in your game
You wouldn't draw the line on the hDC for the window, just in memory... But as you said, it probably isn't a good solution anyways...
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer