Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Blinking Stars
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SK




PostPosted: 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

Turing:





Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: 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).
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: