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

Username:   Password: 
 RegisterRegister   
 Flappy Bird Grass Animation
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Trustworthy




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Trustworthy




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




PostPosted: 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".
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Raknarg




PostPosted: 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
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  [ 5 Posts ]
Jump to:   


Style:  
Search: