Computer Science Canada Problems with jumping in my platform game. |
Author: | GlobeTrotter [ Sat Jun 12, 2004 11:10 pm ] | ||
Post subject: | Problems with jumping in my platform game. | ||
This is my mario-style game. Why is it that: A) When you hold up and down at the same time you sort of fly. B) When you jump from high enough and hold up, you double jump in mid-air sometimes. Any help would be appreciated.
|
Author: | Cervantes [ Sun Jun 13, 2004 8:23 am ] | ||||||||||
Post subject: | |||||||||||
oh my, I love your character! You are truly an artist!! but, unfortunately, in your attempt to give him a mouth, you created the problem that led you here. When your character jumps and you hit down, he looks down. ie, his eyes and mouth move under his body kinda. nice looking, but it screws things up. because then when the program asks,
the whatdotcolour says is checking right where that pesky mouth is and it says "no, it's not = 0" and it therefore goes into that if statement, and does this:
Now that jump is false, both of these conditions:
can be satisfied, since jump was made false. your second problem is the same. after a while, his mouth and eyes aim downwards if he's in the air long enough. hitting down just accelerates how long it takes before his eyes and eyebrow are underneath him. So, basically, he's jumping off of his own mouth. to fix it, comment out this line
now he has no eyebrows, and his eyes aren't a problem because no part of them is exactly in the centre of his body (when using whatdotcolour, you check at x, the exact middle of his body. the eyes are on either side). I guess the easiest way to fix this is chaning the colours around a bit. Make his mouth a dark brown or something and incorporate that into the whatdotcolour collision. now its time for my question(s): in an if statement when you're comparing two things, what does ~= do? I guess its like not but im not sure. I'm ~ sure? and what's with the ~ before chars in this if statement:
Cheers |
Author: | SuperGenius [ Sun Jun 13, 2004 9:10 am ] |
Post subject: | |
I like the complex animation of the character, in only a few lines. good job on that. |
Author: | mynameisbob [ Sun Jun 13, 2004 10:02 am ] |
Post subject: | |
Cervantes, I think your talking about his mouth. |
Author: | Cervantes [ Sun Jun 13, 2004 12:44 pm ] |
Post subject: | |
erg, i tihnk that you will have to do the same thing with the eyes, because if you are moving left or right one part of the eyes will have the same x value as the centre of the character.. in other words, you can do the double jump if you are moving left or right. |
Author: | GlobeTrotter [ Sun Jun 13, 2004 1:25 pm ] | ||
Post subject: | |||
Thanks. I figured it out from there. I simply changed all ~= 0 to = 7 basically. Then I changed the color of my mouth and eyes so that they are different from the bricks. As for ~=, it is the same as not =. Here is an updated example.
|
Author: | SuperGenius [ Sun Jun 13, 2004 2:43 pm ] |
Post subject: | |
Wow i like what you did with it. |
Author: | GlobeTrotter [ Sun Jun 13, 2004 9:20 pm ] | ||
Post subject: | |||
I added another level, and I have another question. How would it be possible to stop my guy from bouncing? I may keep him bouncing since he is a ball, but for gameplay's sake, I'd like to see how the game plays without the bouncing. I didn't program the bounce intentionally, so I don't know how to stop it. Help please.
|
Author: | mynameisbob [ Sun Jun 13, 2004 10:32 pm ] |
Post subject: | |
they both look like the same level... i think ive found a bug in ur game. Usually when the player falls from a high place he dies, but if you hold down while falling he doesnt die. |
Author: | GlobeTrotter [ Sun Jun 13, 2004 11:11 pm ] |
Post subject: | |
I will try and fix the bug. It is caused by: When the player hits down and he's in mid-air it sets his vertical velocity to a certain amount (less than the max speed before he is killed). The only thing I can think of is so that when you press down in mod-air, you can can only press it once per jump. As for them both being the same level, you have to beat the first level to get to the second. |
Author: | Cervantes [ Mon Jun 14, 2004 8:25 am ] | ||
Post subject: | |||
this game has lots of potential! keep working on it. to stop him from bouncing, try commenting out these lines:
hope that helps |
Author: | beard0 [ Mon Jun 14, 2004 10:19 am ] |
Post subject: | |
Great game! I was messing around with your latest version, and found one little bug: When I was falling quickly, I was able to fall through some of a smaller piece of "ground" I'd suggest that you put your whatdotcolor testing in a for loop to check all the pixels between the bottom of your character, and the pixel at which his bottom would next be at the current velocity. But other than that, it looks pretty good to me. |
Author: | GlobeTrotter [ Mon Jun 14, 2004 3:12 pm ] | ||
Post subject: | |||
Cervantes wrote: this game has lots of potential! keep working on it.
to stop him from bouncing, try commenting out these lines:
hope that helps That doesn't really help, since that is what I use so that when his downward velocity is greater than 1 and he hits the brick in the middle of it, he moves to the top of it. When I uncommented that, and jumped from a relatively high height he went right to the middle of the brick and got stuck. |
Author: | beard0 [ Tue Jun 15, 2004 9:39 am ] |
Post subject: | |
GlobeTrotter: Try re-commenting that section, and applying my for loop whatdotcolor testing, so that as he falls, you can stop him from getting to the middle of the ground that way. (if there's ground somwhere within the space between him and where he should be in the next frame, just set his y value to be on the ground. Once you have this all set up, you'll have to make a level editor ! Good Luck! |
Author: | GlobeTrotter [ Thu Jun 17, 2004 6:44 pm ] | ||
Post subject: | |||
I managed to stop the bounce. I also added some other features: -cooler background -coins -no longer go through blocks Here it is. You need to kill all the people to progress to the next level. Try and collect coins too.
|
Author: | AsianSensation [ Thu Jun 17, 2004 7:18 pm ] |
Post subject: | |
I like the polished look, very very nice, I give bits +20 bits |
Author: | Paul [ Thu Jun 17, 2004 11:07 pm ] |
Post subject: | |
Hm... the collision detection in the latest version you posted isn't workingn for me, I use 4.0.5, once I jump, the guy doesn't stop going down, until it dies. |
Author: | Cervantes [ Sat Jun 19, 2004 9:44 am ] |
Post subject: | |
holy shinkies, batman! that code is getting pretty long. and because of that, its starting to run kinda slow i experienced a bit of what paul said, though it wouldn't always fall all the way to the bottom. hmm, it appears as though the character only falls through the blocks when up or down is being held. oh and theres an error with locatexy. |
Author: | GlobeTrotter [ Sat Jun 19, 2004 2:18 pm ] |
Post subject: | |
I wasn't able to recreate your issue with falling through the floor. I don't know what the problem is if I cant see it. Also, the program works at a fine speed for me. There is a delay in there you can adjust if need be. What error is there with locatexy? By the way, have any of you been able to beat both levels while getting all the coins? |
Author: | Cervantes [ Sat Jun 19, 2004 2:39 pm ] |
Post subject: | |
line 431, column 93 is greater than maxcol of 92. maybe try jumping on the mouse at the start and, while your doing your jump off of the mouse, move over so your over top of the platform. when i do that, i go right through everytime. oh and i can see the coins only for a second at the start of the prog, then they disappear but i can still collect them. did you do that on purpose? and finally, you might wanna make ppl lose coins for dying. right now you can get infinate coins by dying and getting coins again. |
Author: | GlobeTrotter [ Sat Jun 19, 2004 4:16 pm ] |
Post subject: | |
That is really weird. I can't recreate any of your errors. My coins are there the whole time. I can't do your jumping thing, and I have no errors with the locatexy. I'm using turing v4.05. The only thing I can think of is its a problem with RGB.AddColor and maybe the number of colors in the settings for your computer. Not sure though. The coins problem where you keep them when you die, I realized that after I posted the code. Its not worth reposting the code for that problem though. |
Author: | this_guy [ Mon Jun 21, 2004 9:11 am ] |
Post subject: | |
the first level is unbeatable after u get to the large lava pit. i dunno if u need more platforms or smthg. really like ur background. also, ur smilie dies when he falls off 2 platforms simutaneously. |
Author: | GlobeTrotter [ Mon Jun 21, 2004 2:16 pm ] |
Post subject: | |
It is possible after the lava pit. You need to jump off the bad-guy to get to the next platform. Here are some controls for those of you who need them: On the Ground ----------------- up : jump left : move left right : move right down : crouch In mid-air ----------------- up : nothing left : move left right : move right down : fall quicker (if pressed early enough in the jump) Bouncing off Bad-Guys ----------------- up : jump higher than usual left : move left right : move right down : go through him to the ground nothing : slight jump |
Author: | GlobeTrotter [ Mon Jun 21, 2004 6:22 pm ] | ||||
Post subject: | help | ||||
Okay, I've run into a major problem while I was trying to make a "view". You'll see what I mean when you run my program. The problem seems to be that whatdotcolor collision detection. My issue is both with my enemies and my coins. Occassionally, I'm not exactly sure when/why all the coins in my current view will disappear. Also, my enemies, when they are outside my view they reverse direction. I'm not sure what my problem is with my coins, so I need help with that. I know what my problem is with my enemies though. How would I be able to make my enemies' vy = 0 when they aren't inside the thing. PS. I am unable to indent the file, sorry. When I hit F2, I get an error saying that there's not enough memory to indent the file. PPS. One last question. If possible, I would like to know how to change this line:
so that the setscreen thing where it is 300,300 actually includes the variable names. I know its something like +intstr(gsizex) but I can't get the syntax right. EDIT: nevermind about the setscreen thing. I figured out that I had to put a '+' on both sides of the instr. And the coin problem, I found a way to recreate it. In the first level, move over to the right after killing the first bad-guy. Walk underneath the floating platform to the left of the lava and hold up. All the coins in your view disappear. Again, I have no idea why this happens. Here's the full code with views:
|
Author: | Cervantes [ Mon Jun 21, 2004 7:25 pm ] | ||
Post subject: | |||
code is getting too long to post as text from now on, plz attach the .t file. I don't know how you did your View thingy, haven't looked at the code that intensely, but can you not do something like:
can't really help you with the coin thingy though. i can't see the coins ever. and i noticed that i only have that falling through the ground problem if i have died since i started the program. ie. i start the program and it works fine. but then i die, and it resets itself and puts me back at the start, and then i fall through stuff. |
Author: | GlobeTrotter [ Mon Jun 21, 2004 7:36 pm ] |
Post subject: | |
That won't really work (the vy thing) since the evy is an array of the enemie's vy. I made a new function called gwhatdotcolor that doesn the same thing as normal, except modifies the entered coordinates to fit the view correctly. How can I modify an array from inside a function? |