Guitar hero animation flickering problem
Author |
Message |
Waugh
|
Posted: Thu May 24, 2018 12:37 pm Post subject: Guitar hero animation flickering problem |
|
|
I'm programming a guitar hero game for my programming class and I am having difficulty with the animation of the circle things that fall down that you tap.
The problem is that because I have the "cls" part in each of the codes, it will run and clear the screen from all of the other falling objects as well, which gives the flickering effect.
I need help with what I should do to achieve this effect without the flickering. Should I use the View.Update style things, if so how? Or if anyone has any better ideas I am open to them of course.
Thank you!
Here is that section of the code to help visualize/ make it easier to know what I mean (the "cls" parts have been bolded, as they are the issue spots so I figured it might be easier to make them stand out):
process Blue
var Purple_y1 : int := 620
var Purple_y2 : int := 680
for i : 1 .. 90
cls
drawfillstar (100, Purple_y1, 160, Purple_y2, 13)
Purple_y1 := Purple_y1 - 15
Purple_y2 := Purple_y2 - 15
delay (25)
end for
end Blue
process Red
var Red_y1 : int := 620
var Red_y2 : int := 680
for i : 1 .. 90
cls
drawfillstar (360, Red_y1, 420, Red_y2, 12)
Red_y1 := Red_y1 - 15
Red_y2 := Red_y2 - 15
delay (25)
end for
end Red
fork Blue
fork Red |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Fri May 25, 2018 12:33 pm Post subject: RE:Guitar hero animation flickering problem |
|
|
Instead of having two processes running simultaneously, you can use a single procedure that moves both circles, then draws both circles, and then erases everything, with just one loop. |
|
|
|
|
|
Srlancelot39
|
Posted: Fri May 25, 2018 1:17 pm Post subject: Re: Guitar hero animation flickering problem |
|
|
In my experience, you should only need one clear statement and one update statement (per "thread"?). This will not only reduce/avoid flashing, but also make your code more clear and easy to follow.
As Insectoid said, what you are doing can be done in just one process/thread (i.e. the main program "thread")...which is good, because Turing doesn't do parallel processing properly and this shows when graphics are run in a process. In contrast, audio doesn't seem to be affected when run in a process. |
|
|
|
|
|
|
|