A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Questions on tonypa's tutorials

  1. #1

    Questions on tonypa's tutorials

    Ive gone through tonypa's awesome tutorials for making tile based games and have had success with them all (im doing the as1 ones) but when it comes to combining all the elements into one deal there are a few spots im getting hung up on. If anyone has gone through them (i know as1 is way out of style these days) and could offer any pointers on even one of them ide appreciate it. Thanks!

    1- both the checkmovingtiles and checkifoncloud need to be used in the movechar function in the same spot, how do i combine the two different codes?
    if (ob.downleft and ob.downright and !checkMovingTiles(speed*diry))
    {
    ob.y += speed*diry;
    } else {
    ob.jump = false;
    if (ob.onMovingTile)
    {
    ob.y = ob.onMovingTile.y-ob.onMovingTile.height-ob.height;
    } else {
    ob.y = (ob.ytile+1)*game.tileH-ob.height;
    }
    }
    }
    and
    if (ob.downleft and ob.downright and !checkIfOnCloud (ob))
    {
    ob.y += speed*diry;
    } else {
    ob.y = (ob.ytile+1)*game.tileH-ob.height;
    ob.jump = false;
    }
    }
    2-When it comes to using slopes, the detectkeys function is set up so the as long as the spacebar is down, the left and right input doesnt register (he cant move in the air!) thats easy enough to change but when i do that he tends to glitch some while jumping on the slope (especially while running uphill & jumping)

  2. #2
    Robot Master the--flash's Avatar
    Join Date
    Jul 2005
    Location
    The year 20XX...
    Posts
    132
    1 - Did you try just adding the other check into the same if sequence, like this?

    Code:
    if (ob.downleft and ob.downright and !checkMovingTiles(speed*diry) and 
    !checkIfOnCloud (ob))
    Some things in the tonypa tutorial aren't meant to overlap, but this should work fine, I havn't read them in a bit so I dunno.

    2 - I never did the slopes part, so I dunno.

  3. #3
    Sorry- I mean im trying to get it to check both of them separately , but i cant seem to phrase it right. No ELSE statement i make is working. I may be overlooking something simple because I am very new to this, but Ive had success with really everything else.

  4. #4
    Robot Master the--flash's Avatar
    Join Date
    Jul 2005
    Location
    The year 20XX...
    Posts
    132
    Why do you need to check them seperately? Either the character can move or he can't-there's no real in between, is there? I don't really see what you're trying to do here...

  5. #5
    Youre totally right! I was skeptical but i tried it and it actually worked out perfectly.
    if (diry == 1)
    {
    if (ob.downleft and ob.downright and !checkMovingTiles(speed*diry) and !checkIfOnCloud (ob))
    {
    ob.y += speed*diry;
    }
    else
    {
    ob.jump = false;
    if (ob.onMovingTile)
    {
    ob.y = ob.onMovingTile.y-ob.onMovingTile.height-ob.height;
    }
    else
    {
    ob.y = (ob.ytile+1)*game.tileH-ob.height;
    }
    }
    }
    Many thanks!


    Anyone have ideas on the slopes?

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