Computer Science Canada Platform Help |
Author: | B-Man 31 [ Mon Dec 14, 2009 10:24 pm ] | ||
Post subject: | Platform Help | ||
What is it you are trying to achieve? Trying to get the ball to land on the platform Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
|
Author: | mirhagk [ Mon Dec 14, 2009 11:40 pm ] |
Post subject: | RE:Platform Help |
look into linear collision detection here calculating distance does not work very well in instances like this one. |
Author: | B-Man 31 [ Tue Dec 15, 2009 7:29 am ] |
Post subject: | RE:Platform Help |
Thats all fine and dandy, but i would like to know WHY it isnt working because ive used this before in a brick game and it worked perfectly. |
Author: | B-Man 31 [ Tue Dec 15, 2009 10:12 am ] | ||
Post subject: | Re: Platform Help | ||
I Ended up solving it, here is the code for anyone who9 wishes to see it:
|
Author: | DemonWasp [ Tue Dec 15, 2009 10:12 am ] | ||
Post subject: | RE:Platform Help | ||
Put this right above your collision detection line:
Move around. Oops. Those values didn't change, did they? Well, why not?! Because your object design is wrong. You have class platform inherit player. This establishes the following relationship: "All platforms are players". I sincerely hope that this is not what you intended. The practical upshot is that in platform.detect(), platform is referencing the values of its own user variable, rather than those of the player variable you created elsewhere in your code. You will need to pass the platform the coordinates of the object it is (potentially) colliding with. |
Author: | mirhagk [ Tue Dec 15, 2009 12:08 pm ] |
Post subject: | RE:Platform Help |
the collision detection is looking pretty good actually. It's been a while since I've used non-linear collision detection actually. Once you learn it you can't stop coding with it. (lol kinda like turing) |
Author: | B-Man 31 [ Tue Dec 15, 2009 5:23 pm ] |
Post subject: | RE:Platform Help |
i know, i ended up solving it with help from a guy in my class who is much stronger in OOP than i am. |
Author: | mirhagk [ Wed Dec 16, 2009 8:30 am ] |
Post subject: | RE:Platform Help |
I find OOP kinda strange. I mean obviously stuff like weapons and vehicles that could have sub-classes of it should be OOP but I find too many people just drool over OOP just because it's complicated. |
Author: | DemonWasp [ Wed Dec 16, 2009 10:39 am ] |
Post subject: | RE:Platform Help |
At the high school level it's probably true that the complication of OOP is what drives a lot of people. Later on, however, OOP is actually a pretty decent framework for solving complicated problems. The difference is in scale: one would hope that most high school projects never exceed around 4000-5000 lines of code, while in the real world of programming, projects often exceed 1000 times those numbers. At that size, proper encapsulation and separation of responsibilities becomes critical. |
Author: | mirhagk [ Wed Dec 16, 2009 11:40 am ] |
Post subject: | RE:Platform Help |
Yeah but in turing.... lol I just get pained when people make a module for someone to use, except they make it OOP, which just makes it harder for someone to use in their program. |
Author: | B-Man 31 [ Thu Dec 17, 2009 9:21 am ] |
Post subject: | RE:Platform Help |
ok, im just using OOP to get practise with it, as ill be moving on to C++ next year for my programming class at school. ill be starting to learn over the summer to have a little bit of a head start, but because i feel i am stronger in turing, im am trying to get the basics down of OOP. |