dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Help With my jumping game

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    Help With my jumping game

    I have a jumping game because I have recently started a project on a platformer type game, because of the kool things I saw in the post Jumping where blanius and others showed how to make a character jump.

    I Have a problem though. Sence I'm using a box code from connelete, whenever my character colides with the platforums he stops and cant go through it because its a box code. This code worked great when I had a small character (a ball) in which when I started out my project. But now that I created a larger character (a blue creature), he is too big that he colides with the platforums causeing him to stop even if he isnt on top of the platforum. So to resolve this, I created some boots for the character called body, and the boots are called "guy". and they do all of the moving, because they are small and wont ram into platforms above them. Now that I have the boots moving/jumping/stoping when landing on the floor or platforums, how do I get the main part of the character called "body" to follow the boots so it moves everywhere the boots moves? If you can help me get this to work, my guy wont stop when he collides with platforms above him.

    Heres the source, play it in your browser and you will see what I want you to do.

    left and right arrows = move, space bar = jump
    Attached Files Attached Files
    Last edited by sonic04; 01-10-2006 at 06:06 PM.

  2. #2
    Senior Member
    Join Date
    May 2005
    Posts
    163
    I think this fixes your problem (or at least gets you headed in the right direction).

    Here's what I did.

    Renamed your "guy" paint object to "boots". Them added a layer and called it "guy" and added the "body" and "boots" paint objects as children to it.

    Modified your "Collision with Start" 1 & 2 to detect collision only with "boots" and not with the combined "guy".

    By combining the seperate parts you can move everything together but still test each of the children/parts for collision.

    Hope it helps.
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    but there is still one problem. After you get the first 3 stars, the 3 new platforms and stars pop up. Jump onto the second platform. Then hold the left arrow so the guy keeps moving left. Sence the body part is working with the box code he stops and doesnt fall.... Thats why i need the body to ONLY fallow the boots so that the body doesnt interact with the platforms and cause the character to completely stop.

    Do you know how I can do this?

  4. #4
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    wait... I think I just have to modify collision with the platforms to only work with the boots... ill try it and see if it fixes my problem

  5. #5
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    uhh... That didnt work, do you know what I can do to fix this problem?

  6. #6
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    first can I suggest replacing my box code with my box function? It makes it simpilar. Um if I get your question, your saying when your guy collides with above platforms it cant even move at all. I suggest taking ym box function and removing the parts that stop you from colliding left right or bottom, that way you only wont fall through the platforms but can still go through them left or right and jump up through them. Kinda confusing but I can try and explain it more if you dont get it.
    BC

  7. #7
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    I see youve said you dont understand the box function, let me suit up your game with my function by tommarow and check back tommarow.
    BC

  8. #8
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    well the thing is I only used the code for the BoxBottom that you made up for the platforms I used are just lines.... I didnt create whole boxes so I thought that code would work. I didnt use the WHOLE box code I just used the code for the BoxBottom element. But the problem is my character is to big so maybe I have to space out the platforms more? I dont know but what you were saying before I dont think thats an issue because i didnt use a code for the Boxleft and Box Right in which you created.

  9. #9
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    um well its in the function, it works so it stops you only if youve colided with it and are moving towards that direction. If I get rid of the left right and bottom then you can only land on the platform, like I said let me wokr with it and check back this time tommarow.
    BC

  10. #10
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    alright

    alright thanks tons, cause I couldnt figure out how to get the function although I just realized the reason why its not working is because I used the boxbottom code when I should be using the BoxTop code that you made, but im sure their is some bug in that so Ill just check back this time tommorow like you said.

    thanks

  11. #11
    Senior Member
    Join Date
    May 2005
    Posts
    163
    OK, I modified it so that the boots have soles and all collisions are checking the soles and not the boots (the soles are just lines on the bottom of the boots). I also made a change to the "end script" because when the score hit 30 it went to level2 which is fine but it would kept doing this because the score stayed at 30. So I put a stop in the script to prevent this from happening and level2 seems to work.

    Again, hope it helps.
    Attached Files Attached Files

  12. #12
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    hey I looked at your movie and I dont really have time to mess with it, but if you look at the example I attached you'll see how that specific box function would make your game easier to make and faster running. Just put the function in the starting script and have another script running everyframe saying root.box(element1,box). Ofcourse replace element1 with your guy and box with the particular platform. That way youll just have one script with a few lines of code instead of those huge complex box scripts. Take a look at the movie, also I edited the function to not have left right or bottom so it can go through the box unless its on top of it.
    Attached Files Attached Files
    BC

  13. #13
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    alright sweet! Thanks ppedz for the modified file, it worked great! And it solved all of the problems I've had so far.

    And connelete, i checked out the boxthing and It sure seemed easier than the way I'm doing things

    I think I get it, but sence I would have to use the code for multiple platforms, how would I do so? would I just use the same function code and keep using it for all of my platforms (switching the platform names), then place the code in the starting script? Or is their another way to do it just using the one function?

    edit:

    I cant figure out how to get the fuction working

    I put it in my starting script and replaced the function to (guy,BoxBottom), and put in the script which called the guy element1 and boxbottom box. I still can't get it to work however, It says that the code getbounds() wasnt working and my element guy is a layer but that shouldnt hurt anything.
    Last edited by sonic04; 01-11-2006 at 09:29 PM.

  14. #14
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    you dont replace it in the starting script, if you look in the example that I posted theres a script running every frame saying root.box(element "dude", element "box"). You leave the function as it is with the names and by running the root.box it runs the function "box" and replaces the element 1 and box with element "dude", element "box". Basically dont change the funtion and just make a script run everyframe saying

    root.box(element "dude", element "platform 1")
    root.box(element "dude", element "platform 2")
    root.box(element "dude", element "platform 3")
    etc....

    the reason its easier is because you just have to say root.box etc and it runs the whole function without you having to copy it. You DONT have to change the function. If you do it wont work. Get it?
    BC

  15. #15
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    oooooooooooooooo alright i understand now... Boy! that seems way easier, thanks for the tips but I have to go so I wont be able to really try it out until tommorow most likely.

    Thanks again.

  16. #16
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    alright i applied the new changed and recieved the following error:


    function box(element1,box) was given 4 parameters when 2 were expected
    function box(element1,box) was given 4 parameters when 2 were expected
    function box(element1,box) was given 4 parameters when 2 were expected

    Do you know what the problem is?

    Somethings not right. The reason why the errors came up was, i believe, because I had assigned to many elements to the box function.
    Last edited by sonic04; 01-11-2006 at 10:44 PM.

  17. #17
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    it could be a couple of things.

    1. did you say root.box(etc)?
    2. You cant say root.box(element guy, element plat1, element plat2) you have to say
    root.box(element guy, element plat1)
    root.box(element guy, element plat2)
    3. You can use use movies or layers, it has to be a direct paint or bitmap I think.

    Tell me if this helps.
    BC

  18. #18
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    ok

    ok so wait, what about etc? Is that part of the code?

    I noticed you said to put that a few times but I thought u literally meant etc.... But how would i write root.box etc as an actually code? How to i incorporate "etc" into the code because i didnt so that must be the problem
    Last edited by sonic04; 01-12-2006 at 08:59 PM.

  19. #19
    Senior Member
    Join Date
    Jan 2003
    Posts
    169
    Quote Originally Posted by sonic04
    ok so wait, what about etc? Is that part of the code?

    I noticed you said to put that a few times but I thought u literally meant etc.... But how would i write root.box etc as an actually code? How to i incorporate "etc" into the code because i didnt so that must be the problem
    I believe etc is used here as a placeholder, not something you would type.
    Jeffrey Davis (3DFA user since 2.x... or was it 3.x?) (Yes, I finally reveal the offline identity of JSDvs9172, being myself of course. Oh, and sorry for stealing your signature idea, blanius, which I see you stopped using.)

  20. #20
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    im pretty sure you have to use it is the code, for connelite mentioned it above

    but the problem is I'm not sure how to do this.

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