# Platform Game

**URL:** https://forum.kirupa.com/t/platform-game/26817
**Category:** programming
**Created:** [July 26, 2003, 7:16pm UTC](https://forum.kirupa.com/t/platform-game/26817 "2003-07-26T19:16:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![BullDog\_Flash](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@BullDog\_Flash](https://forum.kirupa.com/u/BullDog_Flash)
#### Post date: [July 26, 2003, 7:16pm UTC](https://forum.kirupa.com/t/platform-game/26817/1 "2003-07-26T19:16:19Z")

</div>

Ok Since I havent done Platform games in like my whole programming time I completly forgot how and understood.

So I commented this code to see if it was right and now I mam checking with you to check with the code.

```auto
onClipEvent (load) {
    // Variables for setting velocity Accelartion and Jumping
    vel_y = 0;
    accel = 4;
    jumping = false;
}
onClipEvent (enterFrame) {
    // Boundaries Of The Platform
    my_bounds = new Object();
    my_bounds = this.getBounds(_root);
    t_edge = my_bounds.Ymin;
    b_edge = my_bounds.Ymax;
    if (Key.isDown(Key.RIGHT)) {
        this._x = this._x+5;
    }
    // Move Left
    if (Key.isDown(Key.LEFT)) {
        this._x = this._x-5;
    }
    // Jumpin Is allowed
    if (gravity eq "on" and platform eq "off" and !jumping) {
        this._y = this._y+12;
        jumping = true;
    }
    // Key To Jump
    if (Key.isDown(Key.UP) && !jumping) {
        platform = "no";
        vel_y = 22;
        jumping = true;
    }
    // To Jump Or Not TO Jump(that is the question)
    if (jumping == true) {
        if (platform eq "on") {
            gravity = "on";
            vel_y = 0;
            jumping = false;
        } else {
            gravity = "off";
        }
        vel_y -= accel;
        if (vel_y<-12) {
            vel_y = -12;
        }
        this._y -= vel_y;
    }
    // Settings
    platform = "off";
    gravity = "on";
    // Boundaries In THe Level
    if (this._x<=10) {
        this._x = 10;
    }
}

```

if I am wrong could you maybe Tell me what it does do then.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2003, 10:37am UTC](https://forum.kirupa.com/t/platform-game/26817/2 "2003-07-27T10:37:17Z")

</div>

Seem right, but i never actually knew you could write a line like this:

[AS]  
if (gravity eq “on” and platform eq “off” and !jumping) {  
[/AS]

can you?? …weird

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2003, 4:04pm UTC](https://forum.kirupa.com/t/platform-game/26817/3 "2003-07-27T16:04:20Z")

</div>

Yeah it was from the tutorial i seen.

eq is equal you can change the eq to =
