Platform Game with hills

I want to make a platformer game like super mario. But I want
my game to have hills in it.
There is a very famous flash game called Fancy Pants
Adventure 2. It is a platformer with hills in it.
I want to know how to do that. I can make a platformer game
using hitTest(); but that only works with boundary boxes and not
diagonal and curved objects (like hills). I have looked all over
the internet to find out how to do this but I can not find my
answer. If you know how to do this then you are absolutely amazing
in my eyes and could you please explain to me how to do it.
Thank you

So there is no way for flash to see if two objects collide
without boundary boxes with actionscript. Motion guides would take
forever if they are what I think they are.

Similar Messages

  • Where to start with a simple platform game?

    What resources should I look at to learn how to create a very simple platform game, with a charactor who can simply jump on platforms and avoid enemies to reach the end of the level?
    I have made games like this with other languages but never flash.
    Thanks.

    I am also interested in this answer but in my case from the aspect of Silverlight-only developer with no flash experience (I know that sucks
    Thanks,
    Nikola

  • Adobe Flash CS5 Platform Game Movement With Arrow Keys Help!?

    Hello, I am a beginner to flash gaming. I am making a platform game, but  can not reverse my character when he goes backwards. This is my code  for left and right:
    if (Key.isDown(Key.RIGHT)) {
    _x += speed;
    if (Key.isDown(Key.LEFT)) {
    _x -= speed;
    How Can I reverse it so when it goes LEFT, the character turns all the  way around?

    Ok, I fiured it all out, the other way you mentioned. Just opened up the character MC, and named 2 frames. One LEFT and one RIGHT. Then I added a few simple lines of code, and turned out with this:
    if (Key.isDown(Key.RIGHT)) {
    _x += speed;
    this.gotoAndStop("right");
    if (Key.isDown(Key.LEFT)) {
    _x -= speed;
    this.gotoAndStop("left");
    Thanks for helping!!!

  • Error #1009 in my Platform Game! Please Help!!!

    In my basic platform game I have a "hero" that can walk and jump on the "ground." There is also a door to the next scene, which is the next level.The first scene works fine, but "TypeError: Error #1006: value is not a function. at Charles3_fla::MainTimeline/frame1()" pops up once in the output. It works however, and I'm not worried about it. The second I go throught the door though, Scene 2 opens, but then starts flashing as "TypeError: Error #1009: Cannot access a property or method of a null object reference. at Charles3_fla::MainTimeline/onenter()" pops up A LOT in the output. I don't know how to fix it, and would like help. P.S. I am using Adobe CS5 with actionscript 3
    Here is the code for Scene 1:
    hero.gotoAndStop('still');
    var Key:KeyObject = new KeyObject(stage);
    var vy:Number=0;
    var gravity:Number=2;
    var jumped:Boolean = false;
    stage.addEventListener(Event.ENTER_FRAME,onenter)(true);
    function onenter(e:Event):void{
    vy+=gravity;
    if(! ground.hitTestPoint(hero.x,hero.y,true)) {
      hero.y+vy;
    if(ground.hitTestPoint(hero.x+(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x-=13;
    if(ground.hitTestPoint(hero.x-(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x+=13;
    if (vy>10) {
      vy=10;
    for (var i:int = 0; i<10; i++) {
      if (ground.hitTestPoint(hero.x,hero.y,true)) {
       hero.y--;
       vy=6;
       jumped=true;
    if(door.hitTestObject(hero)){
        gotoAndPlay(1,"Scene 2");
    if(hero.y>300){
      vy=6;
      jumped=true;
      if(Key.isDown(Key.UP) && jumped){
       vy=-13;
       jumped=false;
       hero.y+=vy;
    if(Key.isDown(Key.RIGHT)){
      hero.x+=10;
      hero.scaleX=1;
      hero.gotoAndStop('walking');
      }else if(Key.isDown(Key.LEFT)){
      hero.x-=10;
      hero.scaleX=-1;
      hero.gotoAndStop('walking');
      }else{
       hero.gotoAndStop('still');
    And for Scene 2...
    hero.gotoAndStop('still');
    var Key1:KeyObject =KeyObject(stage);
    var vy1:Number=0;
    var gravity1:Number=2;
    var jumped1:Boolean = false;
    stage.addEventListener(Event.ENTER_FRAME,onenter1)(true);
    function onenter1(e:Event):void{
    vy1+=gravity;
    if(! ground.hitTestPoint(hero.x,hero.y,true)) {
      hero.y+vy;
    if(ground.hitTestPoint(hero.x+(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x-=13;
    if(ground.hitTestPoint(hero.x-(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x+=13;
    if (vy1>10) {
      vy1=10;
    for (var i:int = 0; i<10; i++) {
      if (ground.hitTestPoint(hero.x,hero.y,true)) {
       hero.y--;
       vy1=6;
       jumped1=true;
    if(door.hitTestObject(hero)){
        gotoAndPlay(1,"Scene 2");
    if(hero.y>300){
      vy1=6;
      jumped1=true;
      if(Key.isDown(Key.UP) && jumped1){
       vy1=-13;
       jumped1=false;
       hero.y+=vy;
    if(Key.isDown(Key.RIGHT)){
      hero.x+=10;
      hero.scaleX=1;
      hero.gotoAndStop('walking');
      }else if(Key.isDown(Key.LEFT)){
      hero.x-=10;
      hero.scaleX=-1;
      hero.gotoAndStop('walking');
      }else{
       hero.gotoAndStop('still');
    Please reply as soon as possible, and thanks for your time
    swiatekalex555

    Ok sorry about my misunderstanding. Here's the code with the errors Highlighted. I also downloaded a "KeyObject.as" package, and the contents of that are on the bottom.
    hero.gotoAndStop('still');
    var Key:KeyObject = new KeyObject(stage);
    var vy:Number=0;
    var gravity:Number=2;
    var jumped:Boolean = false;
    stage.addEventListener(Event.ENTER_FRAME,onenter)(true);
    function onenter(e:Event):void{
    vy+=gravity;
    if(! ground.hitTestPoint(hero.x,hero.y,true)) {
      hero.y+vy;
    if(ground.hitTestPoint(hero.x+(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x-=13;
    if(ground.hitTestPoint(hero.x-(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x+=13;
    if (vy>10) {
      vy=10;
    for (var i:int = 0; i<10; i++) {
      if (ground.hitTestPoint(hero.x,hero.y,true)) {
       hero.y--;
       vy=6;
       jumped=true;
    if(door.hitTestObject(hero)){
        gotoAndPlay(1,"Scene 2");
    if(hero.y>300){
      vy=6;
      jumped=true;
      if(Key.isDown(Key.UP) && jumped){
       vy=-13;
       jumped=false;
       hero.y+=vy;
    if(Key.isDown(Key.RIGHT)){
      hero.x+=10;
      hero.scaleX=1;
      hero.gotoAndStop('walking');
      }else if(Key.isDown(Key.LEFT)){
      hero.x-=10;
      hero.scaleX=-1;
      hero.gotoAndStop('walking');
      }else{
       hero.gotoAndStop('still');
    And for Scene 2...
    hero.gotoAndStop('still');
    var Key1:KeyObject =KeyObject(stage);
    var vy1:Number=0;
    var gravity1:Number=2;
    var jumped1:Boolean = false;
    stage.addEventListener(Event.ENTER_FRAME,onenter1)(true);
    function onenter1(e:Event):void{
    vy1+=gravity;
    if(! ground.hitTestPoint(hero.x,hero.y,true)) {
      hero.y+vy;
    if(ground.hitTestPoint(hero.x+(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x-=13;
    if(ground.hitTestPoint(hero.x-(hero.width/2), hero.y-(hero.height/2), true)) {
      hero.x+=13;
    if (vy1>10) {
      vy1=10;
    for (var i:int = 0; i<10; i++) {
      if (ground.hitTestPoint(hero.x,hero.y,true)) {
       hero.y--;
       vy1=6;
       jumped1=true;
    if(door.hitTestObject(hero)){
        gotoAndPlay(1,"Scene 2");
    if(hero.y>300){
      vy1=6;
      jumped1=true;
      if(Key.isDown(Key.UP) && jumped1){
       vy1=-13;
       jumped1=false;
       hero.y+=vy;
    if(Key.isDown(Key.RIGHT)){
      hero.x+=10;
      hero.scaleX=1;
      hero.gotoAndStop('walking');
      }else if(Key.isDown(Key.LEFT)){
      hero.x-=10;
      hero.scaleX=-1;
      hero.gotoAndStop('walking');
      }else{
       hero.gotoAndStop('still');
    the KeyObject.as
    package {
    import flash.display.Stage;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    import flash.utils.Proxy;
    import flash.utils.flash_proxy;
      * The KeyObject class recreates functionality of
      * Key.isDown of ActionScript 1 and 2
      * Usage:
      * var key:KeyObject = new KeyObject(stage);
      * if (key.isDown(key.LEFT)) { ... }
    dynamic public class KeyObject extends Proxy {
      private static var stage:Stage;
      private static var keysDown:Object;
      public function KeyObject(stage:Stage) {
       construct(stage);
      public function construct(stage:Stage):void {
       KeyObject.stage = stage;
       keysDown = new Object();
       stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
       stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
      flash_proxy override function getProperty(name:*):* {
       return (name in Keyboard) ? Keyboard[name] : -1;
      public function isDown(keyCode:uint):Boolean {
       return Boolean(keyCode in keysDown);
      public function deconstruct():void {
       stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
       stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
       keysDown = new Object();
       KeyObject.stage = null;
      private function keyPressed(evt:KeyboardEvent):void {
       keysDown[evt.keyCode] = true;
      private function keyReleased(evt:KeyboardEvent):void {
       delete keysDown[evt.keyCode];
    Help if you can,
    swiatekalex555

  • Help Please!!! AS3 Platform game

    I am creating a a platform game for one of my classes. I am not fimilar with Flash and I am having trouble with the coding. I keep getting this error message
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at TheBallMan2_fla::MainTimeline/frame4()
        at flash.display::MovieClip/gotoAndStop()
        at TheBallMan2_fla::MainTimeline/fl_ClickToGoToAndStopAtFrame_12()
    TheBallMan2 is the name I have my project saved as.
    My partner did all the coding but he doesn't really know what he is doing either. The character is supposed to move with the arrow keys which it did until we added the collision code. Here is our coding...which we got from following a tutorial online.
    /* Click to Go to Frame and Stop
    Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
    Can be used on the main timeline or on movie clip timelines.
    Instructions:
    1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
    About.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_3);
    function fl_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void
        gotoAndStop(2);
    /* Click to Go to Frame and Stop
    Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
    Can be used on the main timeline or on movie clip timelines.
    Instructions:
    1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
    Help.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_4);
    function fl_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
        gotoAndStop(3);
    /* Click to Go to Frame and Stop
    Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
    Can be used on the main timeline or on movie clip timelines.
    Instructions:
    1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
    PlayButton.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_12);
    function fl_ClickToGoToAndStopAtFrame_12(event:MouseEvent):void
        gotoAndStop(4);
    /* Click to Go to Frame and Stop
    Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
    Can be used on the main timeline or on movie clip timelines.
    Instructions:
    1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
    if(Ground.hitTestPoint(Char.x + leftBumpPoint.x, Char.y + leftBumpPoint.y, true)){
        trace("leftBumping");
        leftBumping = true;
    } else {
        leftBumping = false;
    if(Ground.hitTestPoint(Char.x + rightBumpPoint.x, Char.y + rightBumpPoint.y, true)){
        trace("rightBumping");
        rightBumping = true;
    } else {
        rightBumping = false;
    if(Ground.hitTestPoint(Char.x + upBumpPoint.x, Char.y + upBumpPoint.y, true)){
        trace("upBumping");
        upBumping = true;
    } else {
        upBumping = false;
    if(Ground.hitTestPoint(Char.x + downBumpPoint.x, Char.y + downBumpPoint.y, true)){
        trace("downBumping");
        downBumping = true;
    } else {
        downBumping = false;
    var leftBumping:Boolean = false;
    var rightBumping:Boolean = false;
    var upBumping:Boolean = false;
    var downBumping:Boolean = false;
    var leftBumpPoint:Point = new Point(-30, -55);
    var rightBumpPoint:Point = new Point(30, -55);
    var upBumpPoint:Point = new Point(0, -120);
    var downBumpPoint:Point = new Point(0, 0);
    /* Move with Keyboard Arrows
    Allows the specified symbol instance to be moved with the keyboard arrows.
    Instructions:
    1. To increase or decrease the amount of movement, replace the number 5 below with the number of pixels you want the symbol instance to move with each key press.
    Note the number 5 appears four times in the code below.
    Char.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey_4);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed_4);
    stage.addEventListener(KeyboardEvent.KEY_UP, fl_UnsetKeyPressed_4);
    function fl_MoveInDirectionOfKey_4(event:Event)
        if (upPressed)
            Char.y -= 0;
        if (downPressed)
            Char.y += 0;
        if (leftPressed)
            Char.x -= 0;
        if (rightPressed)
            Char.x += 0;
    function fl_SetKeyPressed_4(event:KeyboardEvent):void
        switch (event.keyCode)
            case Keyboard.UP:
                upPressed = true;
                break;
            case Keyboard.DOWN:
                downPressed = true;
                break;
            case Keyboard.LEFT:
                leftPressed = true;
                break;
            case Keyboard.RIGHT:
                rightPressed = true;
                break;
    function fl_UnsetKeyPressed_4(event:KeyboardEvent):void
        switch (event.keyCode)
            case Keyboard.UP:
                upPressed = false;
                break;
            case Keyboard.DOWN:
                downPressed = false;
                break;
            case Keyboard.LEFT:
                leftPressed = false;
                break;
            case Keyboard.RIGHT:
                rightPressed = false;
                break;
    var leftPressed:Boolean = false;
    var rightPressed:Boolean = false;
    var upPressed:Boolean = false;
    var downPressed:Boolean = false;
    var xScrollSpeed:int = 10;
    var yScrollSpeed:int = 10;
    function keyDownHandler(e:KeyboardEvent):void{
    if(e.keyCode == Keyboard.LEFT){
    leftPressed = true;
    } else if(e.keyCode == Keyboard.RIGHT){
    rightPressed = true;
    } else if(e.keyCode == Keyboard.UP){
    upPressed = true;
    } else if(e.keyCode == Keyboard.DOWN){
    downPressed = true;
    function keyUpHandler(e:KeyboardEvent):void{
    if(e.keyCode == Keyboard.LEFT){
    leftPressed = false;
    } else if(e.keyCode == Keyboard.RIGHT){
    rightPressed = false;
    } else if(e.keyCode == Keyboard.UP){
    upPressed = false;
    } else if(e.keyCode == Keyboard.DOWN){
    downPressed = false;
    stage.addEventListener(Event.ENTER_FRAME, loop);
    var scrollX:int = 0;
    var scrollY:int = 0;
    var ySpeed:int = 0;
    var xSpeed:int = 0;
    var speedConstant:int = 5;
    var friction:Number = 0.95;
    function loop(e:Event):void{
        if(leftPressed){
            xSpeed -= speedConstant;
        } else if(rightPressed){
            xSpeed += speedConstant;
        if(upPressed){
            ySpeed -= speedConstant;
        } else if(downPressed){
            ySpeed += speedConstant;
    if(leftBumping){
        if(xSpeed < 0){
            xSpeed *= -0.5;
    if(rightBumping){
        if(xSpeed > 0){
            xSpeed *= -0.5;
    if(upBumping){
        if(ySpeed < 0){
            ySpeed *= -0.5;
    if(downBumping){
        if(ySpeed > 0){
            ySpeed *= -0.5;
        xSpeed *= friction;
        ySpeed *= friction;
        scrollX -= xSpeed;
        scrollY -= ySpeed;
        Ground.x = scrollX;
        Ground.y = scrollY;

    click file>publish settings>swf and tick "permit debugging".  retest.
    the line number of the code that references a non-existant object will be in the error message.
    if you need more help than that, indicate the copy and paste the error message and the line number referenced at the top of the error message.

  • Platform game

    I am a new programmer and ive been through a few tutorials and stuff but now i am trying to make a platform game without just typing from a tutorial. So far all ive been able to do is load and display a ground sprite. I think the next step is to somehow draw the game level using an array with letters to represent different objects(I think thats how most people do it) I have searched everywhere and so far havent found any help though.
    My second question is can someone give me a list of commonly used functions that would help me develope my game.
    Thanks to anyone who helps.

    Hi there,
    I made a java game engine. I really help for those whose start learning java from gaming purposes.
    It is really simple to follow, and pretty fast to create a game.
    Just visit this link and download the library:
    [http://fly.engine.googlepages.com/|http://fly.engine.googlepages.com]
    sample game is provided.
    Hope it really help you.
    Good luck!

  • Platform game code

    Hi guys - Been playing super mario bros with the kids (for them of course). I'm a amateur coder but pretty clued up on AS3 - just not with gaming concepts.
    I would like like to create a platform game - character jumps, climbs etc... onto platforms over objects etc...
    Most coding is quite easy BUT the jumping onto the platform - has anybody got a tut out there. Been googling but fed up with so many bad tuts.
    Just a bit of code for hero to land on platform.
    Suppose I would just hittest and equte the x coordinates of each etc... But how do I get the hero to stand on the platform not.
    Would I just stop the hero falling ie: where the hittest occurs is where the hero will stand. Would that code sit on the hero or on the platforms.

    OK thanks, I'll try that and I suppose I will learn a lot more.
    Cheers

  • How to make a vertical lift or elevator in a platform game

    I am creating a side scrolling platform game using the book "Flash Game University" by Gary Rosenzweig.
    My protagonist has an instance of "hero".
    My current issue is trying to create a lift or elevator to carry the player up or down. The lift is not covered in the book. My thoughts were that the lift constantly moved up and down at a pace determined by a timer. I cannot get my lift to move. I have created a movie clip called "lift" and made it exported for action script. I can make it act similar to a floor movie clip so that I can stand on it, but I cannot get the lift to move on the y axis.
    I tried creating a new function called lift() and using a for loop to count between 0 and 100 using a variable "i" and then make my lift move up 1 unit for each loopcycle. It didn't work.
    lift.y -= lift.y - 1;
    Does anyone have a better solution?
    Thanks,
    Alex

    Rob,
    This worked. Here is my current code ...
    var topIndex:Number = 20;
                        var bottomIndex:Number = 160;
                        var stepDistance:Number = 10;
                        var movingUp:Boolean = true;
    public function createLift()
                                            box = new Object();
                                            box.mc = gamelevel.box;
    public function moveMyLift():void
                                            // lift 01
                                            if (movingUp && box.mc.y > topIndex)
                                                      box.mc.y -= stepDistance;
                                            else
                                                      movingUp = false;
                                              if (!movingUp && box.mc.y < bottomIndex)
                                                      box.mc.y += stepDistance;
                                            else
                                                      movingUp = true;
                                            if (hero.mc.hitTestObject(box.mc))
                                                      hero.mc.y = box.mc.y;
    My lift works correctly. It moves up and down correctly and when I jump on it I stay moving on it. There are only 3 things that don't make sense.
    1. When I am on the elevator I cannot jump. If I am not on the elevator I can jump normally.
    2. When I touch any portion of the elevator, my character automatically repositions itself to stand on the elevator. It seems normal, but not something that should happen in my scenario. I only want to "climb" on the elevator if I touch the "top" of the elevator.
    3. If I add a second elevator, even with its own function, the timing of the elevator math appears to synch instead of work independently. Why? The two elevators synch their movement and timing. Also the first elevator stutters as the synching of the two elevators match thier movement and then moves in unison with the second elevator. Why are they not operating separately?
    Here is the code for the first and second elevator:
    private var box:Object;
    private var box02:Object;
    var topIndex:Number = 20;
    var bottomIndex:Number = 160;
    var stepDistance:Number = 10;
    var movingUp:Boolean = true;
    var topIndexLift02:Number = 1;
                        var bottomIndexLift02:Number = 100;
                        var stepDistanceLift02:Number = 4;
    public function createLift()
                                            box = new Object();
                                            box.mc = gamelevel.box;
                                            box02 = new Object();
                                            box02.mc = gamelevel.box02;
    public function moveMyLift():void
                                            // lift 01
                                            if (movingUp && box.mc.y > topIndex)
                                                      box.mc.y -= stepDistance;
                                            else
                                                      movingUp = false;
                                              if (!movingUp && box.mc.y < bottomIndex)
                                                      box.mc.y += stepDistance;
                                            else
                                                      movingUp = true;
                                            if (hero.mc.hitTestObject(box.mc))
                                                      hero.mc.y = box.mc.y;
                                  public function moveMyLift02():void
                                            // lift02
                                            if (movingUp && box02.mc.y > topIndexLift02)
                                                      box02.mc.y -= stepDistanceLift02;
                                            else
                                                      movingUp = false;
                                              if (!movingUp && box02.mc.y < bottomIndexLift02)
                                                      box02.mc.y += stepDistanceLift02;
                                            else
                                                      movingUp = true;
                                            if (hero.mc.hitTestObject(box02.mc))
                                                      hero.mc.y = box02.mc.y;
    public function gameLoop(event:Event)
                                            // get time difference
                                            if (lastTime == 0) lastTime = getTimer();
                                            var timeDiff:int = getTimer() - lastTime;
                                            lastTime += timeDiff;
                                            // only perform tasks if in play mode
                                            if (gameMode == "play")
                                                      moveCharacter(hero,timeDiff);
                                                      moveEnemies(timeDiff);
                                                      checkCollisions();
                                                      scrollWithHero();
                                                      createLift();
                                                      moveMyLift();
      moveMyLift02();
    Thank you,
    Alex
    Message was edited by: ajdove

  • A beginner trying to create platform game

    I'm a new programmer and just learning Java from the dummies books... I'm trying to make this Java platform game applet that I guess plays like Megaman/Mario/Castlevania.
    Hmm my question would be that my applet slows down a lot on browsers, and I would like to learn how to double buffer as I've seen people suggest on this forum.
    Also I would like to know why the sound doesn't seem to work on 99% of the people who try it.
    You can check the game here: http://www.info.com.ph/~arivera/game/testmain.html
    And the source code is here: http://www.info.com.ph/~arivera/game/source
    Please give suggestions... my code is still very messy and unoptimized too, please bear with me.
    (Updates may occur on the game itself while I work on it.)

    There's two things you'll want to think about implementing in your applet - active rendering and double buffering as you mentioned.
    Active rendering consists of drawing to the screen in the same thread that runs the game applet. By default, when you call repaint(), the AWT Event thread handles the repainting and gets around to repainting the screen whenever it feels like doing so - sometimes not at all! (well, that's not entirely true, but you get the idea)
    Double buffering entails writing to an offscreen buffer, and then drawing that buffer to the screen.
    Thankfully, both are relatively easy to implement.
    Active rendering is the easier of the two to implement. In your game loop, where you call repaint(), don't! Instead, call paint() directly and use the applets getGraphics() method, which will return a Graphics or Graphics2D object for you to use. So instead of having repaint(), replace it with paint(getGraphics());
    Double buffering is a bit more complicated to implement. I'd suggest trying this after you've tried active rendering. Double buffering includes have an Image field in your applet class. I often call it 'buffer', but there's quite a few other common names you'll come across for it.
    To initialize the image, call the applet's createImage(width, height) method. This will return an Image object. You can get a Graphics object that corresponds to that image by calling its getGraphics() method just like you do with active rendering. You no longer want to have all of the painting being done in the paint() method of your applet. Instead, a new method is in order to handle the painting of the game screen to the buffer. Your paint method then should simply call g.drawImage(...) and draw the backbuffer to the screen.
    A small example:
    public class doubleBufferApplet implements Applet
    Image buffer;
    . . . //Other fields
    public void init()
    buffer = createImage(getWidth(), getHeight()); //returns an Image object the size of the applet and assigns it to buffer
    . . . //Do other initializing
    public void run()
    while(gameIsStillRunning) //Main game loop
    . . . //Run through and update the game
    if(buffer != null)
    drawGame(buffer.getGraphics()) //Draw the game to the backbuffer
    paint(getGraphics()); //Draw the backbuffer to the screen
    public void drawGame(Graphics g)
    . . . //Do your painting here
    public void paint(Graphics g)
    if(buffer != null)
    g.drawImage(buffer, 0, 0, this);
    public void update(Graphics g) //Override the default update() method to avoid Java from calling it randomly
    paint(g);
    I hope that gave you a decent idea of how to go about implementaing active rendering and a buffer. If not, I'll try harder to answer any questions you have (or some of the more experienced users around here will help you out as well I'm sure).

  • If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    Hello,
    As frustrating as it seems, your best to post any frustrations about the iPhone in the  iPhone discussion here:
    https://discussions.apple.com/community/iphone/using_iphone
    As this discussion is for iBook laptops.
    Best of Luck.

  • HT4137 I have two iPad's that use the same iTunes/store account. I want the two devices to play games with with other, but it recognizes them as the same. I have set up two different iCloud accounts, but still not recognizing the users as different. What

    Hello, I have no idea if my question went out, so I'll post it again. I have two iPads (one 3rd gen and one 4th) that use the same iTunes/store account. I want the two devices to game with each other, but the apps recognize them as the same. I have created two different iCloud accounts in an attempt to differentiate between the two, but no luck. How can I continue to use the same iTunes/store account for music and movies, but also have the two devices recognize each other for games?

    You can share your iTunes ID and still have separate iCloud accounts with separate IDs, they don't have to be the same.  If you kids don't already have an iCloud account, have them set up separate accounts on their devices using separate IDs.  If they are already sharing your account, migrate their devices to separate accounts.  To do this, start by saving any photo stream photos they wish to keep to ther camera roll (unless already there) by opening your my photo stream album, tapping Select, tap the photos, tap the share icon (box with upward pointing arrow), then tap Save to Camera Roll.  If they are syncing notes with iCloud, you'll need to open each of your notes and email them to them so you can later copy and paste the text into new notes created in their new account.  Then go to Settings>iCloud, tap Delete Account (which only deletes it from thier device and won't effect your device), choose Keep on My iDevice and provide the password to turn off Find My iPhone (if using iOS 7).  Then sign back in with a different Apple ID to create their new account and choose Merge to upload the data.  Once everyone is on a separate account you can go to icloud.com from your computer, sign into each account separately and delete your data from their account.

  • How do i buy games with an itunes gift card?

    just yesterday i upgraded to the ipod touch 5 because my previous one (touch4) was smashed. the day before it was smashed, i redeemed an itunes gift card on it. of course it shows my balance is still there but when i went to buy a game, it needed me to enter new credit card info. i've seen many questions on here saying that yes, you can buy games with an itunes giftcard, but no one answers how, or why it may be doing this. can anyone help?

    Try checking all your money situations on your Apple account.

  • A drag and drop game with dynamic text response

    Hi,
    I am a teacher and my school has recently upgraded to Adobe Design Premium.  Our previous version was about 5 versions out of date.
    I teach A Level which requires students to create an Interactice Multimedia product.
    In the previous 6 years, I have taught students how to create simple drag and drop game with dynamic text responses.
    Since the upgrade to Actionscript 3.0 the dynamic text response has ceased working.
    When creating the game from scratch, I need to move to Actionscript 2.0 as 3.0 does not allow me to add actionscript to objects - I know and am sure that this is a better way of doing things, but I would prefer to keep working the way I am used to.
    I use a switch case statement which I have copied below to make the drag and drop work.  The objects I apply the code to work in that they can be dragged, however, my dynamic text box with a variable name of "answer" is no longer displaying the response when an answer is left on a dropzone (rectangle converted to a symbol and given an instance name).
    on(press) {
    startdrag(this);
    on(release) {
    stopdrag();
    switch(this._droptarget) {
      case "/dropzoneB":
       _root.answer="Well done";
       break;
      case "/dropzoneA":
      case "/dropzoneC":
       _root.answer="Hopeless";
       break;
      default:
       _root.answer="";
       break;
    Any help would be much apeciated.
    Thanks
    Adrian

    To drag in as3
    blie_btn is the instance of the object drawin on the stage. In AS3 you have to assign a even listener, in this case MOUSE_DOWN, and MOUSE_UP, as we want the drag to stop if the mouse is not clicked. Then we fire the functions, and tell the object to start drag.
    // Register mouse event functions
    blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    // Define a mouse down handler (user is dragging)
    function mouseDownHandler(evt:MouseEvent):void {
         var object = evt.target;
         // we should limit dragging to the area inside the canvas
         object.startDrag();
    function mouseUpHandler(evt:MouseEvent):void {
         var obj = evt.target;
              obj.stopDrag();
    if you want to make the text do what you want then something like this might work.
    In the function, you could add a text box onto the stage, give it a instance of something like outputText
    and then:
    outputText = ("Bla Bla Bla");
    (^Not sure if this will work exactly^)
    PS. I am currently a A-level student

  • I have a 27" iMac and want to play Windows games with optimal performance.  what do I need to do?

    I have a 27" iMac and want to play Windows games with optimal performance.  What do I need to do?

    Install windows with Bootcamp. http://www.apple.com/support/bootcamp/

  • We like to play games with Spigo. But the games do'nt come totaly on the PC. I think they are 75 %. Can you help us? r.sissing@planet.nl

    # Question
    We like to play games with Spigo. But the games do'nt come totaly on the PC. I think they are 75 %. Can you help us? [email protected]

    Do you mean that the game doesn't load or that you do not see the complete page?
    Reset the page zoom on pages that cause problems: <b>Beeld > Zoomen > Herinitialiseren</b> (Ctrl+0 (zero))
    * [[Page Zoom]]
    * [[Text Zoom]]

Maybe you are looking for