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 / Is it possible to reproduce a flickering on object at a constant frequency ?

Author
Message
curse
6
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 31st Mar 2013 19:40
Hi guys, I need to change the color of an object (preferably 2d) at a certain frequency (20 Hz, 15 Hz, 12 Hz). Have you got some tips how to do this?

Thanks in advance for answers.
granarout
6
Years of Service
User Offline
Joined: 2nd Jan 2013
Location:
Posted: 2nd Apr 2013 15:14
You can use a delta change of dbTimer() to get milliseconds and then use 1/f (the time period) and compare them
curse
6
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 18th Apr 2013 12:19
Thanks granarout for your suggestion.
Actualy, I am using this code

but I have some problems.
When I use dbSprite I obtain a strange issue.
[img]null[/img]
When I use dbPasteImage I obtain another issue. I think two print of FPS at same time.


I need only a black background color.
Any advice?

Thanks for you answers.
Juggalo Memnoch
11
Years of Service
User Offline
Joined: 22nd Apr 2008
Location:
Posted: 19th Apr 2013 05:04 Edited at: 19th Apr 2013 05:06
Changing the background color can be done with



Hope that helps

EDIT: You can just put those right after the dbSyncRate fucntion..

curse
6
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 19th Apr 2013 10:59 Edited at: 19th Apr 2013 11:00
Yeah, this solve my problem. I searched for a while the function that set the backdrop color, but I had not found it, so I used a sprite and an image.
Do uou have any idea of why the sprite and the image give me that issues?
However, final code:


Thanks Juggalo Memnoch!
Juggalo Memnoch
11
Years of Service
User Offline
Joined: 22nd Apr 2008
Location:
Posted: 19th Apr 2013 20:21
No problem.. Glad I could help.
Unfortunately I don't really have anything to offer for your other issue.. Sorry

Good luck

curse
6
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 20th Apr 2013 00:22
You have solved my issue, but I was looking for an explanation of why it does not work with the image or the sprite as a background!

Thanks!
Juggalo Memnoch
11
Years of Service
User Offline
Joined: 22nd Apr 2008
Location:
Posted: 20th Apr 2013 05:02
Ohh... My bad..
From what I see you just pasted the "Background" image once before the loop. So it doesn't get refreshed every loop. And without turning the backdrop on everything just kinda gets piled onto each other. With the backdrop on at the start of every loop it kinda wipes the screen clean and starts fresh. You could also just Paste the "Background" image at the beginning of every loop and it should work too, it's just easier to do the backdrop(For me anyway)

curse
6
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 21st Apr 2013 10:22
It is true, you're right. I had not thought to put the dbPasteImage or dbSprite on each loop. I thought there was no need.
Again, thanks for your reply .

Login to post a reply

Server time is: 2019-09-17 09:14:34
Your offset time is: 2019-09-17 09:14:34