Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Weird problem when loading an object in the while loop

Author
Message
jontepd
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Sweden
Posted: 19th Mar 2009 10:57 Edited at: 19th Mar 2009 11:00
I have some code where a tank is positioned at the screen and the tank will move to the location you specify by the right mouse click, the tank is a class called Tank. However i've run into a weird problem, when i load the tank outside of the while loop (before the while loop) everything works fine, but if i load the object inside the while loop, the object will only move when you hold your right mouse button in, (it will not move to the specified location unless you hold in your right mouse click all the time).

This is the piece of the with the object loading outside of the while loop.
The problematic code is marked with stars.



This is the code if i place the object loading inside the while loop, the object will only move when i hold the right mouse button in.

Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Mar 2009 11:37
I guess you may have a problem with repeated key-strokes.
jontepd
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Sweden
Posted: 19th Mar 2009 15:49
And how do i solve the problem?
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Mar 2009 16:53
There are several methods, you can try



Still, just guessing that it could have been causing problems...
jontepd
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Sweden
Posted: 20th Mar 2009 13:34
It has nothing to do with the control key, this didn't work either..
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 20th Mar 2009 17:37
Allright, I don't see any other problem.
What you describe as the problem, to have the right mouse button held down for the tank to move, only happens if that right mouse click was not over the map object.
If the target is made over the map, then the tank turns with just one click, so revise that dbPickObject is reaching the map and returning something here:
jontepd
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Sweden
Posted: 20th Mar 2009 20:05 Edited at: 20th Mar 2009 20:05
It's not that, i always click on the map. And it works when i load the tank object outside of the while loop, shouldn't work if the problem was what you're describing..
jontepd
15
Years of Service
User Offline
Joined: 24th Feb 2009
Location: Sweden
Posted: 20th Mar 2009 20:09
Actually you were right with the control key stuff o_O
It works when i did this...


Thanks for the help!

Login to post a reply

Server time is: 2024-11-25 16:42:15
Your offset time is: 2024-11-25 16:42:15