3 Replies Latest reply: Jun 28, 2012 1:55 PM by esdebon RSS

    Help with rhythm game

    Mattielolo

      So i am starting university in late september (to learn 3d character animation) and need to get the grades to get in, sadly we have a flash programming unit in the college course im in now and we didnt get taught anything at all and i mean nothing, we were given printed sheets and told to copy the code word for word. so i really need help with my game. how would i make the movement of something my cursor? so when i move the cursor it follows it? also how do i play an animation on click?

      My  idea for the game is to have a rhythm style game where the player moves the net and catches the bee's, something i thought would be simple to figure out how to do

       

      This is my game at the minute, ive used the code we were told to copy from sheets and just changed the sprites :\ any help would be amazing!
      https://www.dropbox.com/s/1pjbv2mavycsi3q/sopaceship%20rev7%20%20moving%20bullet.fla

        • 1. Re: Help with rhythm game
          Ned Murphy CommunityMVP

          You should search Google for a tutorial.  Try using search terms like "AS3 custom cursor tutorial"  THat should help you with having something following the cursor.  As far as clicking something to make something happen, I would bet even the printed sheets you were given will have enough information for you to work out such a basic functionality.

          • 2. Re: Help with rhythm game
            Mattielolo Community Member

            we werent taught anything about animations, we were given coding that let us shoot,move,add walls and add enemies. unless im missing something im sure we didnt learn that thanks anyway

            • 3. Re: Help with rhythm game
              esdebon Community Member

              http://orangesplotch.com/blog/flash-tutorial-elastic-object-follower/

               

              var distx:Number;

              var disty:Number;

              var momentumx:Number;

              var momentumy:Number;

               

              follower.addEventListener(Event.ENTER_FRAME, FollowMouse)

              function FollowMouse(event:Event):void {

                   // follow the mouse in a more elastic way

                   // by using momentum

                   distx = follower.x - mouseX;

                   disty = follower.y - mouseY;

                   momentumx -= distx / 3;

                   momentumy -= disty / 3;

               

                   // dampen the momentum a little

                   momentumx *= 0.75;

                   momentumy *= 0.75;

               

                   // go get that mouse!

                   follower.x += momentumx;

                   follower.y += momentumy;

              }