Computer Science Canada Blinking Stars |
Author: | SK [ Tue Apr 19, 2016 5:17 pm ] | ||
Post subject: | Blinking Stars | ||
What is it you are trying to achieve? I'm trying to have stars blinking from yellow to any other colour (let's say white) What is the problem you are having? I'm not sure how it works... whenever I type in the animation code, it just disappears Describe what you have tried to solve this problem I used xchange:=0 as the star won't be moving. Yet the star disappears. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) var x : int := 400 var y : int := 420 var x2 : int := 420 var y2 : int := 440 var xchange : int := 0 setscreen ("graphics:640;480") colourback (9) for row : 1 .. 25 for column : 1 .. 80 locate (row, column) put " " end for end for loop drawfillstar (x, y, x2, y2, yellow) delay (50) if x > 640 then xchange := -5 elsif x < 0 then xchange := 5 end if drawfillstar (x, y, x2, y2, 9) x := x + xchange end loop
Please specify what version of Turing you are using 4.1.1 |
Author: | Dreadnought [ Tue Apr 19, 2016 5:25 pm ] |
Post subject: | Re: Blinking Stars |
You probably want to wait a bit in between colour changes so that the colours don't change too fast. Try putting a delay after each colour change (not just one). Also, if your stars aren't moving, then you might want to consider removing any code that would be used for moving objects (it shouldn't change the behaviour, but would make your code cleaner). |