Computer Science Canada One-way Boundaries for game |
Author: | notAllCS [ Tue Apr 29, 2008 2:40 pm ] |
Post subject: | One-way Boundaries for game |
I am trying to advise a student about how he can create one-way boundaries in his "Commander Keen" inspired game. I have told the rest of the class to use View.WhatDotColor for their boundaries, but this will not work for his game because he wants his character to be able to jump through a step and land on the step. any ideas? ![]() |
Author: | zylum [ Tue Apr 29, 2008 2:42 pm ] |
Post subject: | RE:One-way Boundaries for game |
Well if the y-velocity of the player is positive (moving up/jumping) then do not check for collision. This causes the player to pass through the boundary. When it is falling, check for collisions. |
Author: | raidercom [ Tue Apr 29, 2008 2:43 pm ] |
Post subject: | Re: One-way Boundaries for game |
How are the levels being drawn? From a file? Are there any attributes associated with the one-way wall that can be used to identify it? |
Author: | Sean [ Tue Apr 29, 2008 2:43 pm ] |
Post subject: | RE:One-way Boundaries for game |
There are different ways to make boundaries. And it isn't View.WhatDotColor, it is whatdotcolor. whatdotcolor is collision based on the colour of something, however you can make your own boundaries by comparing player x and y values with object values too. There is a tutorial I believe already made. |
Author: | notAllCS [ Tue Apr 29, 2008 2:47 pm ] |
Post subject: | RE:One-way Boundaries for game |
thanks. I forgot the character would have a y-velocity...that will work. |
Author: | Saad [ Tue Apr 29, 2008 2:52 pm ] |
Post subject: | Re: RE:One-way Boundaries for game |
Sean @ Tue Apr 29, 2008 2:43 pm wrote: There are different ways to make boundaries. And it isn't View.WhatDotColor, it is whatdotcolor.
whatdotcolor is collision based on the colour of something, however you can make your own boundaries by comparing player x and y values with object values too. There is a tutorial I believe already made. Your post is seriously wrong there. - First of all they do the exact same thing. - Secondly You should not use whatdotcolor instead of View.WhatDotColor. Why? This is because this tells us we are using the whatdotcolor function that belongs to the View module rather then just having a function that is called whatdotcolor. On a side note while whatdotcolor collision is a simple concept (information is located here), it should be avoided. Graphics and the game engine should be independant of each other (A better alternative located here) |
Author: | Sean [ Tue Apr 29, 2008 3:01 pm ] |
Post subject: | Re: RE:One-way Boundaries for game |
Saad @ Tue Apr 29, 2008 2:52 pm wrote: Sean @ Tue Apr 29, 2008 2:43 pm wrote: There are different ways to make boundaries. And it isn't View.WhatDotColor, it is whatdotcolor.
whatdotcolor is collision based on the colour of something, however you can make your own boundaries by comparing player x and y values with object values too. There is a tutorial I believe already made. Your post is seriously wrong there. - First of all they do the exact same thing. - Secondly You should not use whatdotcolor instead of View.WhatDotColor. Why? This is because this tells us we are using the whatdotcolor function that belongs to the View module rather then just having a function that is called whatdotcolor. On a side note while whatdotcolor collision is a simple concept (information is located here), it should be avoided. Graphics and the game engine should be independant of each other (A better alternative located here) Yes, I did make the biggest mistake there. Ignore what I posted. Only look at the y value part like before ![]() |
Author: | isaiahk9 [ Mon May 05, 2008 4:52 pm ] |
Post subject: | Re: One-way Boundaries for game |
I don't see why you cannot use View.WhatDotColor. Just make it so that if the player position (x, y) is the color of the platform, playery = player y + 1. Throw that in a loop, and the character should be able to jump through a platform up, but then he can't jump back down. |
Author: | Saad [ Mon May 05, 2008 4:56 pm ] |
Post subject: | Re: One-way Boundaries for game |
isaiahk9 @ Mon May 05, 2008 4:52 pm wrote: I don't see why you cannot use View.WhatDotColor.
Just make it so that if the player position (x, y) is the color of the platform, playery = player y + 1. Throw that in a loop, and the character should be able to jump through a platform up, but then he can't jump back down. You want to avoid using it for collision detection because the game engine and graphics engine should be independent of each other. |
Author: | Tony [ Mon May 05, 2008 5:29 pm ] |
Post subject: | Re: One-way Boundaries for game |
isaiahk9 @ Mon May 05, 2008 4:52 pm wrote: Just make it so that if the player position (x, y) is the color of the platform...
The player position (x,y) is the colour of the player. |