Flappy Bird Grass Animation
Author |
Message |
Trustworthy
|
Posted: Mon May 26, 2014 6:35 pm Post subject: Flappy Bird Grass Animation |
|
|
What is it you are trying to achieve?
I'm trying to get the grass to move smoothly across the bottom of the screen at the same time as running the program.
What is the problem you are having?
I'm not sure how I would do it at the same time as running the program.
Describe what you have tried to solve this problem
The flappy bird game is just the concept I want to use for my project...I have yet to write any code on it, but only understand how it works.
Please specify what version of Turing you are using
4.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Mon May 26, 2014 8:08 pm Post subject: RE:Flappy Bird Grass Animation |
|
|
animation is just displaying pictures, frame by frame (making a movie by taking one photo at a time). In case of a game, you draw everything (background, characters, UI) at time T, process controls, update positions, then draw everything again, as they would appear at time T+1. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Trustworthy
|
Posted: Tue May 27, 2014 5:53 pm Post subject: Re: Flappy Bird Grass Animation |
|
|
Thanks very much Tony! But I know how animation works, I just don't know how to animate something, and at the same time, say, collect a mouse click from the user. Is there a command for this? |
|
|
|
|
|
Tony
|
Posted: Tue May 27, 2014 7:10 pm Post subject: RE:Flappy Bird Grass Animation |
|
|
There is no "at the same time", only "one after another, but really fast". |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Raknarg
|
Posted: Tue May 27, 2014 10:50 pm Post subject: RE:Flappy Bird Grass Animation |
|
|
or, that is to say, that in terms of animation, having two things happen one after another is effectively the same as having them happen at the same time.
Look at this, for example:
Turing: |
setscreen ("offscreenonly")
var x1, y1, x2, y2 : int := 50
var dir1, dir2 : int := 2
loop
x1 := x1 + dir1
if x1 > maxx then
dir1 := - 2
elsif x1 < 0 then
dir1 := 2
end if
Draw.FillOval(x1, y1, 10, 10, brightred)
y2 := y2 + dir2
if y2 > maxy then
dir2 := - 2
elsif y2 < 0 then
dir2 := 2
end if
Draw.FillOval(x2, y2, 10, 10, brightblue)
View.Update
delay(5)
cls
end loop
|
Obviously, these two things are not happening at the same time, and yet you cannot tell that by the animation |
|
|
|
|
|
|
|