1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 Animation for the bird

Discussion in 'Programming' started by River, Jan 9, 2020.

Tags:
  1. River

    River Member

    Joined:
    Oct 23, 2019
    Posts:
    6
    Hey there! This is a my first post here and i'm new Gamemaker so I got the basic question about making game by using Game maker engine, hope everyone can help or explain this problem well enough for me. Thanks so much!
    Now, i'm making the small project that the bird can fly (randomly) and after this bird can perch bird and eating something with full animations. How can I do it?
     
  2. Cupid Stunt

    Cupid Stunt Member

    Joined:
    Dec 11, 2019
    Posts:
    76
    Do you see the bird from the side or from the top?
     
  3. River

    River Member

    Joined:
    Oct 23, 2019
    Posts:
    6
    Yes, it is top-down view. How i can do it such as: what's about create? and in step what's things I need to do? Sorry, because I', newbies here so I need anybody can help for creating coding. Thank :)
     
  4. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    2,092
    You'll need some sprite animations too, but I suppose you already have that in plans. It looks like your entity will have multiple behaviors. Usually this means the basic structure should be built with a coding practise called state machines. It separates code for each state into their own block and has a variable that describes the current behavior state. For your bird, the structure would go something like:
    Code:
    // CREATE Event
    
    // Define all states.
    enum Bird_State {
       Perch,     // Bird is sitting idle.
       Eat,       // Bird animates eating.
       Fly        // Bird flies around and animates flight.
    }
    
    // Define starting state
    State = Bird_State.Perch;
    
    // STEP Event
    
    if(State == Bird_State.Perch){
       // Code here that controls perching and can switch the bird to eat or fly states.
    }
    else if(State == Bird_State.Eat){
       // Code here that controls eating and can switch the bird to perch state.
    }
    else if(State == Bird_State.Fly){
       // Code here that controls flight and can switch the bird to perch state.
    }
    
    It should be easy to find more GMS code specific use case examples by googling around a bit.
     

Share This Page