
-----------------------------------
bluedevils_77
Thu Apr 20, 2006 4:17 pm

help soon plz
-----------------------------------
im doing a solar system, thing for my grade 11 animation. If suppoused to show the planets moving around the sun, then quickly doom into earth. How can i make the middle point of earth be the middle point of the window,. Also the window is set to 1500, 1000 for the solar system, how can i make it smaller, without doing anohter View.Set. cuz view.set amkes it close the window and bring up a new one.

my code is:

View.Set ("graphics:1500,1400;offscreenonly")
var t, r,sec,d,u,n,m,rad,rad1 : int
var ang, ang1, ang2, ang3, ang4, ang5 : real
var x, y, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5 : real
var star : int

rad1:= 29
n:= 700
m:= 1000
d:= maxx div 2
u:= 1000
ang := 0
ang1 := 47
ang2 := 234
ang3 := 250
ang4 := 100
ang5 := 176
sec:= 0
colorback (7)
cls
%star---=========
for i : 1 .. 300
    t := Rand.Int (0, maxx)
    r := Rand.Int (0, maxy)
    Draw.FillOval (t, r, 1, 1, 14)
end for
%sun===============================================================
Draw.FillOval (maxx div 2, maxy div 2, 70, 70, 42)
loop
%mercury=========================================================================
Draw.FillOval(d, u, 1, 1, 14)
Draw.FillOval(n,m,1,1,14)
    x := (maxx div 2) + 103 * cosd (ang)
    y := (maxy div 2) + 103 * sind (ang)
    Draw.Oval (maxx div 2, maxy div 2, 103, 103, 56)
    Draw.FillOval (round (x), round (y), 17, 17, white)
    ang := ang + 5.6
    delay (20)
%venus=======================================================================
    x1 := (maxx div 2) + 160 * cosd (ang1)
    y1 := (maxy div 2) + 160 * sind (ang1)
    Draw.Oval (maxx div 2, maxy div 2, 160, 160, 56)
    Draw.FillOval (round (x1), round (y1), 23, 23, 12)
    ang1 := ang1 + 4.5
    delay (20)
    %earth===================================================================
    x2 := (maxx div 2) + 240 * cosd (ang2)
    y2 := (maxy div 2) + 240 * sind (ang2)
    Draw.Oval (maxx div 2, maxy div 2, 240, 240, 56)
    Draw.FillOval (round (x2), round (y2), 29, 29, blue)
    ang2 := ang2 + 3.4
    delay (20)
    %mars==============================================================
    x3 := (maxx div 2) + 320 * cosd (ang3)
    y3 := (maxy div 2) + 320 * sind (ang3)
    Draw.Oval (maxx div 2, maxy div 2, 320, 320, 56)
    Draw.FillOval (round (x3), round (y3), 24, 24, brown) %need new brown!!
    ang3 := ang3 + 2.8
    delay (20)
    %Jupiter
    x4 := (maxx div 2) + 480 * cosd (ang4)
    y4 := (maxy div 2) + 480 * sind (ang4)
    Draw.Oval (maxx div 2, maxy div 2, 480, 480, 56)
    Draw.FillOval (round (x4), round (y4), 38, 38, 162)
    Draw.ThickLine (round (x4) - 42, round (y4), round (x4) + 42, round (y4), 2,white)
    ang4 := ang4 + 2.2
    delay (20)
    %Saturn
    x5 := (maxx div 2) + 630 * cosd (ang5)
    y5 := (maxy div 2) + 630 * sind (ang5)
    Draw.Oval (maxx div 2, maxy div 2, 630, 630, 56)
    Draw.FillOval (round (x5), round (y5), 35, 35, 61)
    Draw.ThickLine (round (x5) - 40, round (y5), round (x5) + 40, round (y5), 4,11)
    ang5 := ang5 + 2.2
    delay (20)
    View.Update
    Draw.FillOval (round (x2), round (y2), 29, 29, black)
   Draw.Oval (maxx div 2, maxy div 2, 240, 240, 56)
     exit when sec = 50  
    %redarwing
    Draw.FillOval (round (x3), round (y3), 24, 24, black)
    Draw.FillOval (round (x), round (y), 17, 17, black)
    Draw.FillOval (round (x1), round (y1), 23, 23, black)
    Draw.FillOval (round (x4), round (y4), 38, 38, black)
    Draw.ThickLine (round (x4) - 42, round (y4), round (x4) + 42, round (y4), 4,
black)
    Draw.FillOval (round (x5), round (y5), 35, 35, black)
    Draw.ThickLine (round (x5) - 40, round (y5), round (x5) + 40, round (y5), 4,
black)
  Draw.FillOval(d, u, 1, 1, 7)
%shoting star
     d:= d- 9
     u:= u - 3
delay(10)
%time to watch planets111
%shoting star
sec:= sec + 1
if sec = 30 then 
n:=n - 7
m:=m -3
end if
end loop

-----------------------------------
TokenHerbz
Thu Apr 20, 2006 4:31 pm


-----------------------------------
ok 2 things 1st,

1)  Use proper "help" titles when posting.  Plz help soon is not pleasent.

2)  When posting code, use CODE tags...

You would be lucky if you post isn't deleted, but i will post again with some help for you, if i can...   Give me a few minuates.

-----------------------------------
Clayton
Thu Apr 20, 2006 4:38 pm


-----------------------------------
i dont think you can actually resize the window without closing it the re-opening it. also, look into arrays, as they will help make your code neater, as you are new here i will suggest you to go to the Turing Walkthrough, where you can look through just about anything in turing, to make the earth the center of your screen (im assuming its just a circle) do something like this

var x,y:int:=0
const RADIUS:int:=10

Draw.FillOval(maxx div 2,maxy div 2,RADIUS,RADIUS,black)

what ive done is drawn a circle with its center coordinates at half of the maximum x and half of the maximum y, with a radius of 10 pixels in the color black good luck i hope this helped

-----------------------------------
bluedevils_77
Thu Apr 20, 2006 4:43 pm


-----------------------------------
we dunt learn arrays for another couple weeks...

-----------------------------------
Clayton
Thu Apr 20, 2006 4:48 pm


-----------------------------------
check out the Turing Walkthrough (as mentioned above) as it takes you right through turing, and if you stick with it you will be miles ahead of your compsci class

-----------------------------------
HellblazerX
Thu Apr 20, 2006 4:51 pm


-----------------------------------
i think wut you're asking for is how to have the window follow the earth as it does its orbit.  In that case, you'll need do some scrolling.  Basically, when you're drawing the planets and stuff, you'll need to draw them in according to their position from the earth.

Let's say for, example, your earth is at position (100,100), and Mars was at (200,200).  To draw Mars, you would need to find its position relative to the earth.  So, if the earth is to be drawn in the middle, (maxx div 2, maxy div 2), then Mars should be drawn at (200 - 100 + maxx div 2, 200 - 100 + maxy div 2).

-----------------------------------
bluedevils_77
Thu Apr 20, 2006 5:01 pm


-----------------------------------
ive set it up so for, so when it exits the loop so when the planets stop in the program,all the planets should move over til earth is in the middle.  My teacher said an easy way to zoom into earth, is just make it bigger, but the window is so big, u still see everything ebhind. cuz i dunt want to make earth totally gagantic

-----------------------------------
TokenHerbz
Thu Apr 20, 2006 5:02 pm


-----------------------------------
thats incorrect superfreak, as his sun is is the center, and he wants the map centered on earth which is rotating around the sun...

To do this i think you need to modify your code something wicked.

Here is a little idea to help you, because i dont want to mess with your code...


Ex1:  Useing the mouse:

setscreen ("Graphics:max;max,offscreenonly")
View.Set ("offscreenonly")

var mapx, mapy : int := 0   %%chords of map
var Scroll_Rate : int := 5  %%how fast your map moves
var x, y, b : int   %%mouse chords (for this example

proc draw_map (mapx, mapy : int)
    drawfillbox (maxx div 2 + mapx, maxy div 2 + mapy, maxx div 2 + 50 + mapx, maxy div 2 + 100 + mapy, black)
end draw_map

loop
    cls

    Mouse.Where (x, y, b)
    if y >= maxy - 40 then     %%moves map up with mouse
        mapy -= Scroll_Rate
        draw_map (mapx, mapy)
    elsif y = maxx - 40 then     %%moves map right with mouse
        mapx -= Scroll_Rate
        draw_map (mapx, mapy)
    elsif x 