Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Having difficulty with an imported picture.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Rusty Screws




PostPosted: Tue Oct 20, 2015 12:48 pm   Post subject: Having difficulty with an imported picture.

What is it you are trying to achieve?
I am trying to draw a picture of space and have the space ship image I put in Turing fly around the scene.


What is the problem you are having?
I am having multiple problems, firstly, it removes the background wherever it goes, I know the cause of this, however, I don't know how I would go about fixing it. ( the cause is me placing the image and then moving a pixels up and then putting the image there.)
Secondly, the movement of the space ship, I originally had a bunch of overlapping loop statements that worked, however, my teacher wanted me to use for statements instead as it looked cleaner and I can't for the life of me figure out why one of them won't work. (the last for statement in spaceship movement)
My final problem doesn't have to do with the spaceship, but rather with the planets I drew, even more specific, the ovals inside, the way I created them shouldn't allow for them
to go outside the bigger planet oval, however, they continue to do so.


Describe what you have tried to solve this problem
The for statement, I've tried to declare what the x and y variable are before the statement and then executed it (like I thought I was supposed to) but it doesn't seem to do anything, the program just ends.
The picture removing the background I haven't tried anything for as i'm completely lost when it comes to pictures in Turing.
The interior ovals of the planet, I've tried making it more restricting with how close the middle of the interior ovals can be to the edge of the big oval, it doesn't seem to do anything thought.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
%%% SPACESHIP MOVEMENT
for yy : 0 .. maxy- 300
Pic.Draw (space, x, yy, picMerge)
Time.Delay (5)
end for
y:= maxy-300
for xx : 0..maxx div 3
Pic.Draw(space,xx,y,picMerge)
Time.Delay (5)
end for
x:=maxx div 3
y:=maxy-300
for yy : y.. maxy-900
Pic.Draw(space,x,yy,picMerge)
Time.Delay(5)
end for
%%%%%%
%%% SPACESHIP MOVEMENT
for yy : 0 .. maxy- 300
Pic.Draw (space, x, yy, picMerge)
Time.Delay (5)
end for
y:= maxy-300
for xx : 0..maxx div 3
Pic.Draw(space,xx,y,picMerge)
Time.Delay (5)
end for
x:=maxx div 3
y:=maxy-300
for yy : y.. maxy-900
Pic.Draw(space,x,yy,picMerge)
Time.Delay(5)
end for

Turing:


View.Set ("graphics:max,max,title:Space")
var x, y, x2, y2, r, c, c2, c3, c4, z : int
var space : int := Pic.FileNew ("sp.jpg")
c := Rand.Int (103, 186)
c2 := c - 2
c3 := Rand.Int (45, 103)
c4 := c3 - 2
var end_loop : boolean := false
var finished : boolean := false

Draw.FillBox (0, 0, maxx, maxy, black)

for i : 1 .. 500 %%% STARS
    x := Rand.Int (0, maxx)
    y := Rand.Int (0, maxy)
    x2 := x + 10
    y2 := y + 10
    Draw.FillStar (x, y, x2, y2, yellow)
    Draw.FillOval (900, 650, 110, 170, black)
    Draw.FillOval (300, 300, 110, 170, black)
    Time.Delay (5)
end for
Time.Delay (400)
Draw.FillOval (900, 650, 100, 100, 175) %%% TOP RIGHT PLANET
Time.Delay (400)
for i : 1 .. 2 %%% TOP RIGHT PLANET INTERIOR
    r := Rand.Int (10, 35)
    x := Rand.Int (845, 955)
    y := Rand.Int (595, 725)
    Draw.FillOval (x, y, r, r, 174)
    Time.Delay (100)
end for

Time.Delay (400)
Draw.FillOval (300, 300, 100, 100, c3) %%% LOWER LEFT PLANET
Time.Delay (400)
for i : 1 .. 2 %%% LOWER LEFT PLANET INTERIOR
    r := Rand.Int (10, 35)
    x := Rand.Int (245, 355)
    y := Rand.Int (255, 345)
    Draw.FillOval (x, y, r, r, c4)
    Time.Delay (100)
end for

%%% MUSIC FORK
var i : int := 0

% process BackgroundMusic %%% Music Player
%     loop
%         exit when finished
%         Music.PlayFile ("space.mp3")
%     end loop
% end BackgroundMusic
%
% fork BackgroundMusic    %%% Start background music playing

x := 0
y := 0
z := 0


%%% SPACESHIP MOVEMENT
for yy : 0 .. maxy- 300
    Pic.Draw (space, x, yy, picMerge)
    Time.Delay (5)
end for
y:= maxy-300
for xx : 0..maxx div 3
    Pic.Draw(space,xx,y,picMerge)
    Time.Delay (5)
end for
x:=maxx div 3
y:=maxy-300
for yy : y.. maxy-900
    Pic.Draw(space,x,yy,picMerge)
    Time.Delay(5)
end for
% loop
%     exit when end_loop = true
%     Pic.Draw (space, x, y, picMerge)
%     z := z + 1
%     x := x
%     y := y + 1
%     Time.Delay (5)
%     if y > 600
%             then
%         loop
%             exit when end_loop = true
%             Pic.Draw (space, x, y, picMerge)
%             y := y
%             x := x + 1
%             Time.Delay (5)
%             if x > 560
%                     then
%                 loop
%                     exit when end_loop = true
%                     Pic.Draw (space, x, y, picMerge)
%                     y := y - 1
%                     x := x
%                     Time.Delay (5)
%                     if y < 1
%                             then
%                         loop
%                             exit when end_loop = true
%                             Pic.Draw (space, x, y, picMerge)
%                             y := y
%                             x := x + 1
%                             Time.Delay (5)
%                             if x > 1000 then
%                                 loop
%                                     exit when end_loop = true
%                                     Pic.Draw (space, x, y, picMerge)
%                                     y := y + 1
%                                     x := x - 1
%                                     Time.Delay (1)
%                                     if y > 840
%                                             then
%                                        end_loop := true
%                                        finished := true
%                                        Music.SoundOff %%% MUSIC END
%                                     end if
%                                 end loop
%                                 end_loop := true
%                             end if
%                         end loop
%                     end if
%                 end loop



Turing 4.05
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: