Author: Nathan4102 [ Wed May 29, 2013 5:55 pm ] Post subject: RE:bouncing a ball... PLEASE HELP Your z coord would reflect how close the ball is to the user. When the z is bigger(or smaller), the ball would get bigger. So you could change the radius by some amount based on the z coord.

 Author: coolgirl97 [ Wed May 29, 2013 5:59 pm ] Post subject: Re: bouncing a ball... PLEASE HELP Thanks, but the thing is i'm really new to comp sci.. (have no idea y i took the course), and my teacher does not know how to teach :S so... how exactly do i add the z coord??? Thank you so much!!

 Author: Nathan4102 [ Wed May 29, 2013 6:02 pm ] Post subject: RE:bouncing a ball... PLEASE HELP Well "z" would be another variable, just like x and y, and you'd increase it the same way you increase your other variables. Then when you draw the ball, just have the radius relative in some way to z, instead of the constant RADIUS. E: You'd have to remember to make the ball "bounce" in the z plane as well, just like your x and y's.

 Author: coolgirl97 [ Wed May 29, 2013 6:19 pm ] Post subject: Re: bouncing a ball... PLEASE HELP ignore.. the colour red thing... i did it to show what i added.. but it is html coding, so you won't see the difference right away , anyways... Thanks!

 Author: Nathan4102 [ Wed May 29, 2013 6:26 pm ] Post subject: RE:bouncing a ball... PLEASE HELP No problem, and that should work, except you need to draw your circle based on your z coord aswell.

 Author: Nathan4102 [ Wed May 29, 2013 6:39 pm ] Post subject: RE:bouncing a ball... PLEASE HELP Youre only changing the x and y parameters of "drawfilloval". round(x) and round(y) should stay as the x and y parameters. The thing you need to change is the x and y radius(3'rd and 4'th parameter). Assuming we're looking at this ball straight down the z plane, as z increases, the ball would appear bigger, correct? Thus, as z increases, we need to draw the ball larger.

 Author: coolgirl97 [ Thu May 30, 2013 8:01 am ] Post subject: Re: bouncing a ball... PLEASE HELP Okay... i kinda get what u r saying.. thank you! but.. just one more question... so instead of this: if z > z_front_boundary then z0 := 2 * z_front _boundary - z v0z := -v0z x0 := x t := 0 end if if z < z_back_boundary then z0 := 2 * z_back_boundary - z v0z := -v0z x0 := x t := 0 end if will it be something like this?? : if z > z_front_boundary then RADIUS := 20 v0z := -v0z x0 := x t := 0 end if if z < z_back_boundary then RADIUS := 10 v0z := -v0z x0 := x t := 0 end if THANK U SO MUCH !! <3

Author:  jr5000pwp [ Thu May 30, 2013 8:21 am ]

I wouldn't do it like that personally. I would take more of an approach of
This allows for more logical update code, and better control over different scale/time/distance factors. Note that I used +- to note that both have their advantages and you should decide for yourself if your RADIUS constant should represent the highest radius of the lowest radius.

 Author: coolgirl97 [ Thu May 30, 2013 8:34 am ] Post subject: Re: bouncing a ball... PLEASE HELP so... would depth_scale be a const??? and will i need to use it anywhere else other than drawfilloval? ty!

 Author: coolgirl97 [ Thu May 30, 2013 8:38 am ] Post subject: Re: bouncing a ball... PLEASE HELP okay, so this is what i have so far.. its prob all messed up, but can u tell me what i have to do to make it work?? Thank you so much. drawline (510,360,510,40, black) drawline (510,360,190,360,black) drawline (190,360,190,40, black) drawline (190,40,510,40, black) drawline (450,300,450,100, black) drawline (450,300,250,300,black) drawline (250,300,250,100, black) drawline (250,100,450,100, black) drawline (190,360,250,300, black) drawline (450,300,510,360,black) drawline (190,40,250,100, black) drawline (510,40,450,100, black) %Ball bouncing const RADIUS := 15 const DELTA_TIME := 0.10 const TIME_DELAY := 10 const x_right_boundary := 480 const x_left_boundary := 220 const y_top_boundary := 330 const y_bottom_boundary := 70 const z_front_boundary := const z_back_boundary := var x, y, z , x0, y0, z0, v0x, v0y, v0z ,t : real x0 := 100 y0 := 100 z0 := 100 v0x := 30 v0y := 10 v0z := 20 t := 0 loop x := x0 + v0x * t y := y0 + v0y * t z := z0 + v0z * t drawfilloval (round (x), round (y), round (RADIUS+-z*DEPTH_SCALE), round (RADIUS+-z*DEPTH_SCALE), black) delay (TIME_DELAY) drawfilloval (round (x), round (y), round (RADIUS+-z*DEPTH_SCALE), round (RADIUS+-z*DEPTH_SCALE), white) if x > x_right_boundary then x0 := 2 * x_right_boundary - x y0 := y v0x := -v0x t := 0 end if if x < x_left_boundary then x0 := 2 * x_left_boundary - x v0x := -v0x y0 := y t := 0 end if if y > y_top_boundary then y0 := 2 * y_top_boundary - y v0y := -v0y x0 := x t := 0 end if if y < y_bottom_boundary then y0 := 2 * y_bottom_boundary - y v0y := -v0y x0 := x t := 0 end if t := t + DELTA_TIME cls drawline (510,360,510,40, black) drawline (510,360,190,360,black) drawline (190,360,190,40, black) drawline (190,40,510,40, black) drawline (450,300,450,100, black) drawline (450,300,250,300,black) drawline (250,300,250,100, black) drawline (250,100,450,100, black) drawline (190,360,250,300, black) drawline (450,300,510,360,black) drawline (190,40,250,100, black) drawline (510,40,450,100, black) end loop

 Author: jr5000pwp [ Thu May 30, 2013 9:02 am ] Post subject: RE:bouncing a ball... PLEASE HELP Firstly, your z boundaries aren't set. Secondly, you'd want to declare a DEPTH_SCALE constant. This should probably be a real and you'll just need to play with it until it feels right. Thirdly, you aren't doing checking for your z co-ordinate. You can probably just copy the x or y code you have and substitute z in, making sure to use the appropriate variables such as z_front_boundary.

 Author: coolgirl97 [ Thu May 30, 2013 12:54 pm ] Post subject: Re: bouncing a ball... PLEASE HELP Thank you so much!! I've kinda fixed up everything u told me... is this correct?? : drawline (510,360,510,40, black) drawline (510,360,190,360,black) drawline (190,360,190,40, black) drawline (190,40,510,40, black) drawline (450,300,450,100, black) drawline (450,300,250,300,black) drawline (250,300,250,100, black) drawline (250,100,450,100, black) drawline (190,360,250,300, black) drawline (450,300,510,360,black) drawline (190,40,250,100, black) drawline (510,40,450,100, black) %Ball bouncing const RADIUS := 15 const DELTA_TIME := 0.10 const TIME_DELAY := 10 const x_right_boundary := 480 const x_left_boundary := 220 const y_top_boundary := 330 const y_bottom_boundary := 70 const z_front_boundary := 200 const z_back_boundary := 100 var x, y, z , x0, y0, z0, v0x, v0y, v0z ,t, DEPTH_SCALE : real DEPTH_SCALE := 18 x0 := 100 y0 := 100 z0 := 100 v0x := 30 v0y := 10 v0z := 20 t := 0 loop x := x0 + v0x * t y := y0 + v0y * t z := z0 + v0z * t drawfilloval (round (x), round (y), round (RADIUS+-z*DEPTH_SCALE), round (RADIUS+-z*DEPTH_SCALE), black) delay (TIME_DELAY) drawfilloval (round (x), round (y), round (RADIUS+-z*DEPTH_SCALE), round (RADIUS+-z*DEPTH_SCALE), white) if x > x_right_boundary then x0 := 2 * x_right_boundary - x y0 := y v0x := -v0x t := 0 end if if x < x_left_boundary then x0 := 2 * x_left_boundary - x v0x := -v0x y0 := y t := 0 end if if y > y_top_boundary then y0 := 2 * y_top_boundary - y v0y := -v0y x0 := x t := 0 end if if y < y_bottom_boundary then y0 := 2 * y_bottom_boundary - y v0y := -v0y x0 := x t := 0 end if if z > z_front_boundary then z0 := 2 * z_front _boundary - z v0z := -v0z x0 := x t := 0 end if if z < z_back_boundary then z0 := 2 * z_back_boundary - z v0z := -v0z x0 := x t := 0 end if t := t + DELTA_TIME cls drawline (510,360,510,40, black) drawline (510,360,190,360,black) drawline (190,360,190,40, black) drawline (190,40,510,40, black) drawline (450,300,450,100, black) drawline (450,300,250,300,black) drawline (250,300,250,100, black) drawline (250,100,450,100, black) drawline (190,360,250,300, black) drawline (450,300,510,360,black) drawline (190,40,250,100, black) drawline (510,40,450,100, black) end loop

 Author: Nathan4102 [ Thu May 30, 2013 1:00 pm ] Post subject: RE:bouncing a ball... PLEASE HELP A good way to see if it's correct is to run it, and see if it does what you want it to do. Author: coolgirl97 [ Thu May 30, 2013 1:07 pm ] Post subject: Re: bouncing a ball... PLEASE HELP yea.. good idea!, but the thing is that i only have macs at home.. so i don't have the turing program.... i tried searching for turing programs for macs, but i wasn't able to find one... the only chance i have to run it is during class, and that is if my teacher lets us use the computers..

 Author: Insectoid [ Thu May 30, 2013 1:38 pm ] Post subject: RE:bouncing a ball... PLEASE HELP Here is a mac port of Turing. You'll have to make an account on that site to download it though.

 Author: coolgirl97 [ Thu May 30, 2013 4:19 pm ] Post subject: Re: bouncing a ball... PLEASE HELP thank you, i'll try it out :