Computer Science Canada I am working on a simple platforming project. need some advice. |
Author: | poww10s [ Fri Mar 21, 2014 7:45 pm ] | ||
Post subject: | I am working on a simple platforming project. need some advice. | ||
What is it you are trying to achieve? Create a successful platforming project. What is the problem you are having?ef Got the general concept down earlier in my programming class (GR10), But I cannot figure out why the player (Blue Circle) is stopping in the ground (Bottom of Screen). I am doing it the same as I did before but this is a smaller circle 16 pixel instead of 50. Describe what you have tried to solve this problem I have tried changing how far away the ball should stop at, (doesn't change.) and I had a temporary solution of setting it to stay at y 16 (radius of the ball), but this is not suitable for what I am doing. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using Turing v4.1 |
Author: | tiedye1 [ Fri Mar 21, 2014 9:54 pm ] | ||||
Post subject: | Re: I am working on a simple platforming project. need some advice. | ||||
This statement in your loop essentially says if your player is below y = 16, then stop moving down.
The y < y2 - 16 is actually doing nothing since y2 is always 10, 10-16 = -6 and if y < -6 is true, then y < 16 is also true, so its redundant and can be reduced to.
I'm don't exactly understand the effect you are trying to achieve, could you restate what you want it to do? |
Author: | poww10s [ Sat Mar 22, 2014 12:25 pm ] |
Post subject: | Re: I am working on a simple platforming project. need some advice. |
Oh yeah. I actually removed that part. it didn't really do anything at the time. Basically what is happening, is instead of it stopping like my previous program. This time for some reason it keeps moving for a while and stops further down. this causes it to look like it's clipping through the bottom of the screen, instead of stopping right at the bottom of the screen. I don't have this problem with moving on the x axis, only on the y. |
Author: | tiedye1 [ Sat Mar 22, 2014 1:12 pm ] | ||
Post subject: | RE:I am working on a simple platforming project. need some advice. | ||
The reason its stopping below the screen is that each frame, it may move many pixels down, and your code just stops it when its below a certain point. (notice how the faster its moving down the farther down it can get stuck) You have to set y to 16 when it goes below 16 if you want to keep it from appearing below 16.
|
Author: | poww10s [ Sat Mar 22, 2014 1:36 pm ] |
Post subject: | RE:I am working on a simple platforming project. need some advice. |
That's the only way then? Thanks for helping out. Also, with a module, does it have to all be procedures? Could I write the jumping and collision all in a module then load it via the main program? |
Author: | tiedye1 [ Sat Mar 22, 2014 4:51 pm ] |
Post subject: | Re: I am working on a simple platforming project. need some advice. |
There are always other ways to do things, that's just a simple way. A module can contain most anything, variables, types, procedures, etc. So you could put any part of your program in a module if you want. Read the turing documentation on modules, it describes how to use modules fairly well. http://compsci.ca/holtsoft/doc/module.html |
Author: | poww10s [ Sat Mar 22, 2014 5:36 pm ] |
Post subject: | RE:I am working on a simple platforming project. need some advice. |
Ok thanks. One last thing, is there a way to stop mouse input? I've got a loop set up to gather input from mouse clicks, then add the coordinates to an array, and the array is flexible to allow for the user to input the upper limit. however, if you click anywhere before you enter the limit, then enter the limit, it sets those clicks as data in the array. can I stop this? or at least the mouse input. |
Author: | poww10s [ Sat Mar 22, 2014 5:49 pm ] |
Post subject: | RE:I am working on a simple platforming project. need some advice. |
Also, can I save files, with the File location being "\\Saves\\Levels\\" and having it save local to the file running? so if this was running, and it saved, it would save to the folders in the same directory, not in the C:\ directory. |
Author: | Insectoid [ Sat Mar 22, 2014 7:37 pm ] |
Post subject: | RE:I am working on a simple platforming project. need some advice. |
Quote: is there a way to stop mouse input?
Absolutely. Under what conditions do you want to store mouse coordinates? If those conditions aren't met, don't store them. If you only want Y values greater than 0, check for that before you store them. If you don't want to record clicks before the limit is set, just get the limit before you start checking the mouse state. As for saving, why not experiment. Save a file within Turing and see where it ends up. |
Author: | poww10s [ Sat Mar 22, 2014 8:02 pm ] |
Post subject: | RE:I am working on a simple platforming project. need some advice. |
I've done that, however for some reason it must also be running the loop at the same time. anyway to stop this? if commands for loops don't work to stop them. Also, how do I write arrays to a file, they keep repeating the same number over and over. |
Author: | poww10s [ Sat Mar 22, 2014 11:37 pm ] |
Post subject: | Re: I am working on a simple platforming project. need some advice. |
EDIT: If anyone read this specific post, nevermind I have figured it out. |