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 / Slow expansion

Author
Message
Todeswalzer
14
Years of Service
User Offline
Joined: 13th Apr 2010
Location:
Posted: 28th Apr 2010 12:25
Ok this might be bloody obvious but for some reason something that seems this simple is stumping me, all i want to do is make it so when an object say a sphere comes into contact with say... a box, i want the sphere to expand slowly, now i figured something like this would work :-

bit it seems i was wrong, the sphere just expands instantly and i want it to be a gradual thing, I tried using Step but anything lower than 1 doesn't do anything and 1 just leads to instant resize. This seems to me like such a simple thing but i just can't get my head around it and it's making me feel kinda dumb. Any ideas?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Apr 2010 15:42
You are expanding the sphere in your for/next loop, but not displaying it. The simple fix is to put a SYNC in the loop too. Of course, this will result in nothing else happening until that loop is complete.

BTW, why test for collision again within the loop?

Todeswalzer
14
Years of Service
User Offline
Joined: 13th Apr 2010
Location:
Posted: 28th Apr 2010 15:59
Yeah i realised that i had that duplicated line in there right after i posted it

not quite sure what you mean by putting a SYNC in the loop, do you mean just put the SYNC command alone into the beggining of the loop?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Apr 2010 16:05


TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Apr 2010 17:23
To expand a little on what Ian said - and for the benefit of those reading that didn't already know:

Using Sync On tells DB that you want to be in charge of screen updates. This includes moving and scaling objects.

You do this with the Sync command and until you issue it, you won't see any changes you make in your program.

In your code, you only had one Sync at the end of the main Do..Loop and that's when DB updated the screen - after the Scale Object loop had finished (and the sphere has been scaled to the maximum size).

TDK

Todeswalzer
14
Years of Service
User Offline
Joined: 13th Apr 2010
Location:
Posted: 29th Apr 2010 00:47
Ta much, works wonders thanks

Login to post a reply

Server time is: 2024-09-28 16:33:18
Your offset time is: 2024-09-28 16:33:18