A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [HELP] On A Robot Game

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    [HELP] On A Robot Game

    I am in the early stage of making a robot game... (NOTE: im new at flash)
    and can seem to get these things to work

    what are the numbers decaliring in this
    if(_root.Player._x+30>_x && _root.Player._x-30<_x &&
    _root.Player._y+30>_y && _root.Player._y-30<_y)

    also i am trying to make a box that when the player moves up agaist the block moves with the player this is what i got but... i can only move it sideways not ups have i forgotten sumthing??

    onClipEvent (load) {
    force_x=5;
    }
    onClipEvent (enterFrame) {
    update=0;
    if(this.hitTest(_root.Player._x-3,
    _root.Player._y+_root.Player._height/2,true)) {
    while(this.hitTest(_root.Player._x-3,
    _root.Player._y+_root.Player._height/2,true)) {
    _x-=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h+3,
    _root.Player._y+_root.Player._height/2,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth+3,
    _root.Player._y+_root.Player._height/2,true)) {
    _x+=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
    _root.Player._y,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
    _root.Player._y,true)) {
    _y-=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
    _root.Player._y+_root.Player._height,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
    _root.Player._y+_root.Player._height,true)) {
    _y+=1;
    }
    update=1;
    }
    if(update==1) {
    while(_root.Level.hitTest(_x,
    _y+_height/2+2,true)) {
    _y-=1;
    }
    while(_root.Level.hitTest(_x,
    _y-_height/2-2,true)) {
    _y+=1;
    }
    while(_root.Level.hitTest(_x-_width/2-2,
    _y,true)) {
    _x+=1;
    }
    while(_root.Level.hitTest(_x+_width/2+2,
    _y,true)) {
    _x-=1;
    }
    }

    IS THERE AN EASER WAY !!!!!!!!!!!!!!!!!
    Last edited by Gloo pot; 08-22-2005 at 08:03 AM.

  2. #2
    Style Through Simplicity alillm's Avatar
    Join Date
    Mar 2004
    Location
    Wales
    Posts
    1,988
    Use the [ CODE] [ /CODE] tags (without spaces) to make your code more readable. i dont feel like reading through it all like that.

    Are the [ as] tags back yet?

    Ali

  3. #3
    my x booty it is that BIG
    Join Date
    Jun 2004
    Location
    New York
    Posts
    696
    Code:
    onClipEvent (load) {
    force_x=5;
    }
    onClipEvent (enterFrame) {
    update=0;
    if(this.hitTest(_root.Player._x-3,
    _root.Player._y+_root.Player._height/2,true)) {
    while(this.hitTest(_root.Player._x-3,
    _root.Player._y+_root.Player._height/2,true)) {
    _x-=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h+3,
    _root.Player._y+_root.Player._height/2,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth+3,
    _root.Player._y+_root.Player._height/2,true)) {
    _x+=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
    _root.Player._y,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
    _root.Player._y,true)) {
    _y-=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
    _root.Player._y+_root.Player._height,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
    _root.Player._y+_root.Player._height,true)) {
    _y+=1;
    }
    update=1;
    }
    if(update==1) {
    while(_root.Level.hitTest(_x,
    _y+_height/2+2,true)) {
    _y-=1;
    }
    while(_root.Level.hitTest(_x,
    _y-_height/2-2,true)) {
    _y+=1;
    }
    while(_root.Level.hitTest(_x-_width/2-2,
    _y,true)) {
    _x+=1;
    }
    while(_root.Level.hitTest(_x+_width/2+2,
    _y,true)) {
    _x-=1;
    }
    }
    there you go i did you the favor
    Project||[GAME]-on hold for now
    ------------------
    [Hero]-80%
    [Enemies]-1%
    [Weapons]-90%
    [Items]-0%
    [Levels]-10%

  4. #4
    Official Shoe Shiner thehumanchimp's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    953
    code:

    onClipEvent (load) {
    force_x=5;
    }
    onClipEvent (enterFrame) {
    update=0;
    if(this.hitTest(_root.Player._x-3,
    _root.Player._y+_root.Player._height/2,true)) {
    while(this.hitTest(_root.Player._x-3,
    _root.Player._y+_root.Player._height/2,true)) {
    _x-=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h+3,
    _root.Player._y+_root.Player._height/2,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth+3,
    _root.Player._y+_root.Player._height/2,true)) {
    _x+=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
    _root.Player._y,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
    _root.Player._y,true)) {
    _y-=1;
    }
    update=1;
    }
    if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
    _root.Player._y+_root.Player._height,true)) {
    while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
    _root.Player._y+_root.Player._height,true)) {
    _y+=1;
    }
    update=1;
    }
    if(update==1) {
    while(_root.Level.hitTest(_x,
    _y+_height/2+2,true)) {
    _y-=1;
    }
    while(_root.Level.hitTest(_x,
    _y-_height/2-2,true)) {
    _y+=1;
    }
    while(_root.Level.hitTest(_x-_width/2-2,
    _y,true)) {
    _x+=1;
    }
    while(_root.Level.hitTest(_x+_width/2+2,
    _y,true)) {
    _x-=1;
    }
    }



    even nicer ...that was with the as tags....there doesnt seem to be much difference apart from the colou and font...
    Message on a gravestone: I finished before you in the human race.

    Using: Flash MX

  5. #5
    Style Through Simplicity alillm's Avatar
    Join Date
    Mar 2004
    Location
    Wales
    Posts
    1,988
    Yea, but it used to say action script at the top! i want that back!!!!

    Ali

  6. #6
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    ok sry.. i tryed like 50 diferenct things and i cant get it to work... can some 1 plz write me a code for a movable block EG: when the hero moves into it the block move with the hero...

    the moveable block is called "box" and the hero is called "player"

    oh prety please n e 1

  7. #7
    n00b LeechmasterB's Avatar
    Join Date
    May 2004
    Location
    Switzerland
    Posts
    1,067
    /\/\41I33 y0[_] 540(_)1d \/\/r1t3 1/\/ pr0p3r 3/\/gl15h!
    4150, h0\/\/ d1d y0u \/\/r1t3 411 th4t c0d3 \/\/1th0ut 3v3n I</\/0\/\/1ng \/\/h4t 50/\/\3 0I= th3 I\I(_)/\/\I3b3r5 /\/\34/\/?
    I do stuff that does stuff...

    J-Force

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