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.

Newcomers DBPro Corner / Pong Movement Help

Author
Message
Dexter_
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location:
Posted: 20th Jan 2007 09:35 Edited at: 20th Jan 2007 09:36
hey, just trying to get a simple game going...here's my code so far:



the problem is, whenever i dont have sync, only the first command in the loop can be performed....why is that?

if i put sync at the end of the loop it really makes no difference, i just reallly confused, thx for help in advance

p.s. paddle.bmp atttached

Attachments

Login to view attachments
Gillypie
19
Years of Service
User Offline
Joined: 5th Jun 2005
Location: In Front Of My Computer
Posted: 20th Jan 2007 10:01
i think you need to put "sync on" at the start without the quotaion marks
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 20th Jan 2007 12:32
yep if you drop the sync only the 1st if works.

I think it must be something to do with mousemove() and how it is updated without 'sync'

this works without sync because mousemovey() is only called once per loop:



Its best IMHO to manualy sync anyway.


The word "Gullible" cannot be found in any English Dictionary.
Dexter_
17
Years of Service
User Offline
Joined: 13th Jan 2007
Location:
Posted: 20th Jan 2007 21:34
thx flashing blade, but why cant i just do it without a variable?...why does it skip the 2nd if in the loop?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Jan 2007 22:09
The following might help:

Sync On turns on manual synching. This means that you have to manually use the Sync command when you need it.

What Sync does is synchronise the screen with the world in your computer's memory.

All the commands which create/move objects can be thought of as 'virtual'. In other words, when they are all executed the objects are 'primed' with the new data. The screen still shows the world in the state prior to these operations.

The Sync command then updates the viewable world on-screen to match the commands that you just issued.

This is why you will notice that 3D object-related errors more often than not will result in the Sync line being highlighted as the cause of the error. For the same reason, temporarily turning Sync On to Sync Off in your program will show the correct error line.

Using the Sync command takes time.

Ideally, you should only have a single Sync in your program - at the end of any loop which traps your program and after all of the 3D udating commands have been executed. Adding more simply slows down your program.

TDK_Man

Login to post a reply

Server time is: 2024-09-25 15:26:35
Your offset time is: 2024-09-25 15:26:35