The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: Game Scripting help

  1. #1
    2
    posts
    Registered User

    Game Scripting help

    Hi,
    before I start asking the questions to help my game. I like to say I have actually been interested in Action script and making flash games for a year and half now, and I've been searching around the net for tutorials to help me how write it out, but the ones I found only tell you each statement and command. They don't actually tell you step by step how to write out scripts with the statements and commands you learn. They also don't properly explain well how to use the "()" "{}" ";" and other statements like "!" "%". So Technically what I'm saying is: that I'm not a complete noob who dose not even try to teach them selfs and wants other people to do there coding and claim it to them selfs. The tutorials I found would probably be very helpful to me If I knew how to script well. But right now are basically useless.... And please don't tell me to use google or the flash help files. I tried them a hundred times. They don't teach me what I need.

    Anyway...

    I made a Spongebob flash platform game called Squidward's adventure witch can be viewed here: http://www.newgrounds.com/portal/view/375147
    I need help with giving Squidward an attack, a double run (Runs faster If the key is held on too.) being able to kill Enemies instead of only avoiding them, and lastly making Squidward be able fly in the Sky level. (You don't have to help me with that one If you don't want to, but It would help me a lot and would be highly mentionable in the credits. ^^;)

    Here are the scripts to Squidward, the ground, and the Enemies. Please note
    that Squidwards instance name is character, because I did not make any of the scripts below. I only change some of the variables.


    Squidward:


    onClipEvent (load)
    {
    speed2 = 8;
    _root.scrollright = false;
    _root.scrollleft = false;
    _root.stopscroll2 = false;
    _root.stopscroll = false;
    setProperty("", _x, 100);
    boundry = 100;
    setProperty("", _x, 150);
    boundry2 = 150;
    }
    onClipEvent (enterFrame)
    {
    if (_root.ground.hitTest(this._x + 30, this._y - 25, true))
    {
    _root.stopscroll = true;
    }
    else
    {
    _root.stopscroll = false;
    } // end else if
    if (_root.ground.hitTest(this._x - 30, this._y - 25, true))
    {
    _root.stopscroll2 = true;
    }
    else
    {
    _root.stopscroll2 = false;
    } // end else if
    if (Key.isDown(39) && !_root.ground.hitTest(this._x + 15, this._y - 25, true))
    {
    setProperty("", _xscale, 100);
    if (this._x < boundry2)
    {
    this._x = this._x + speed2;
    }
    else
    {
    _root.scrollleft = true;
    } // end else if
    }
    else if (Key.isDown(37) && !_root.ground.hitTest(this._x - 15, this._y - 25, true))
    {
    setProperty("", _xscale, -100);
    if (this._x > boundry)
    {
    this._x = this._x - speed2;
    }
    else
    {
    _root.scrollright = true;
    } // end else if
    } // end else if
    }
    onClipEvent (keyUp)
    {
    if (Key.getCode() == 39)
    {
    _root.scrollleft = false;
    }
    else if (Key.getCode() == 37)
    {
    _root.scrollright = false;
    } // end else if
    }
    The ground he walks on:


    onClipEvent (load)
    {
    _root.falltime = 0;
    groundspeed = 7;
    }
    onClipEvent (enterFrame)
    {
    if (Key.isDown(32) && !jumping)
    {
    vel_y = 38;
    jumping = true;
    _root.character.gotoAndStop("jumpframe#");
    } // end if
    if (jumping == true)
    {
    vel_y = vel_y - 2;
    if (vel_y <= -15)
    {
    vel_y = -15;
    } // end if
    if (vel_y < 15)
    {
    _root.character.gotoAndStop("fallingframe#");
    ++_root.falltime2;
    } // end if
    this._y = this._y + vel_y;
    } // end if
    if (this.hitTest(_root.character._x, _root.character._y + 18, true))
    {
    vel_y = 0;
    _root.character.gotoAndStop(1);
    _root.falling = false;
    _root.falltime = 0;
    jumping = false;
    }
    else
    {
    this._y = this._y - 20;
    ++_root.falltime;
    if (jumping == false && _root.falltime >= 5)
    {
    _root.character.gotoAndStop(3);
    _root.falling = true;
    } // end if
    } // end else if
    }
    onClipEvent (enterFrame)
    {
    if (_root.scrollleft == true && _root.stopscroll == false)
    {
    this._x = this._x - groundspeed;
    }
    else if (_root.scrollright == true && _root.stopscroll2 == false)
    {
    this._x = this._x + groundspeed;
    } // end else if
    if (this.hitTest(_root.character._x, _root.character._y, true))
    {
    _root.ground._y = _root.ground._y + 5;
    } // end if
    }
    And lastly the enemies:



    onClipEvent (enterFrame)
    {
    if (this.hitTest(_root.character))
    {
    _root.gotoAndPlay("die");
    } // end if
    }

    PS: I'm using flash 8 and Action script V2.

  2. I'd like to help you as you seem not stupid and eager to learn.

    But before I can give you and accurate answer, do you know what your code means? I can completely explain to you the firing code for example, but if you don't even understand the code you have know it's not use! It seems like you copied the code out of tutorials and therefor don't know what the code exactly means. I know how you feel about not being able to find good ones, trust me, I've been there!

    I can explain this one and we can work from there on

  3. #3
    2
    posts
    Registered User
    Yes, please can you help me? And I copied that code from some website.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012