A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: building a flash game?? help please.

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    11

    building a flash game?? help please.

    Hi there.

    I'm looking into making a flash game, but im not to sure where to start.


    The basic idea is to have an person scroll left to right trying to catch things falling from random places from the top of the screen.
    There will be two object falling. One object (object 1) should add to the score and the other object (object 2) would be taking away from the score, more or less.

    The idea is that if they got to much of either object the game would be over. They user would have to maintain a healthy medium between the two.

    Also, the persons graphic would increase if they had two much of object 1 and would decrease when they have object two.

    I hope this makes sense. And I hope someone here would be able to help me out with some links to tutorials and such..


    Like I said... I've never made a game before. But I am pretty good with flash.

    Thanks

  2. #2
    Junior Member
    Join Date
    Mar 2002
    Posts
    11

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Posts
    11
    Originally posted by in the end

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    here's some basic functions that should help a little, it uses a clip with 2 frames, the 2 frames contain the graphics for the different types of objects.

    Code:
    /* a function to define some variables ready for use in the game */
    function setUp() {
        clips = new Array();
        i = 0;
        delay = 3000; // 3 seconds between clips 
        nextClipTime = 0;
    }
    
    function createClip() {
        if (getTimer() > nextClipTime) { // space out the clips
            if (Math.random() < 0.5) { // a 50% chance of a new clip to make the fall of clips a little less uniform
                duplicateMovieClip(_root.instanceName,"newClip" + i, i); // where the clip you want to duplicate has the instance name instanceName
                _root["newClip" + i]._x = Math.round(Math.random() * 500); // random x position
                _root["newClip" + i]._y = -25; // position off the top of the stage 
                   _root["newClip" + i].gotoAndStop(Math.ceil(Math.random() * 2)); // pick a random frame
                clips.push(_root["newClip" + i]); // add the clip to an array
                i++;
                nextClipTime = getTimer() + delay; // no new clips for at least 3 seconds (assuming delay is 3000)
            }
        }
    }
    
    function moveClips() {
        for (var j = clips.length - 1; j > -1; --j) { // loop backwards through the array of clips
            if (clips[j]._y < 400) { // if the clip hasn't disappeared off the bottom of the screen, keep it moving
                clips[j]._y += 5;
             } else if (clips[j].hitTest(_root.player)) { // player is the player movie clip
                 if (clips[j]._currentframe == 1) { // do actions for that type of object
    
                 } else { // do the actions for the other tyupe f object
    
                 }
             }
            } else { // otherwise remove the clip and remove it from the array
                clips[j].removeMovieClip();
                clips.splice(j, 1);
            }
        }
    }

    you can then add a movie clip to run these functions... from a clip event on this clip use,

    Code:
    onClipEvent(load) {
        _root.setUp();
    }
    onClipEvent(enterFrame) {
        _root.createClip();
        _root.moveClips();
    }
    hope this helps get you started

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center