Computer Science Canada moving a picture ... HELP |
Author: | miller6 [ Tue Jan 12, 2010 6:38 pm ] | ||
Post subject: | moving a picture ... HELP | ||
What is it you are trying to achieve? i am trying to create brick breaker on turing What is the problem you are having? getting the picture to move without the train of previous picture positions follwoing and without clearing the whole screen Describe what you have tried to solve this problem <everything i can think of Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
setscreen ("nocursor") setscreen ("graphics:vga") var WinId : int var ch : string (1) % box move const right := chr (203) % box move const left := chr (205) % box move var counter : int := 10 % counter for the bow moving var x := 0 % drop sflake WinId := Window.Open ("position:centre;centre,graphics:1010;695") drawfillbox (1, 1, maxx, maxy, 255) var sflake : int := Pic.FileNew ("sflake.gif") % Pic.Draw (sflake, 0, 100, picMerge) var box : int := Pic.FileNew ("box2.bmp") Pic.Draw (box, 1, 1, picCopy) drawfillbox (500, 500, 625, 520, 5) drawfillbox (500, 400, 625, 420, 5) drawfillbox (550, 450, 675, 470, 5) drawfillbox (550, 550, 675, 570, 5) drawfillbox (320, 500, 445, 520, 5) drawfillbox (375, 550, 500, 570, 5) drawfillbox (320, 400, 445, 420, 5) drawfillbox (375, 450, 500, 470, 5) drawfillbox (210, 550, 335, 570, 5) drawfillbox (210, 450, 335, 470, 5) drawfillbox (160, 500, 285, 520, 5) drawfillbox (160, 400, 285, 420, 5) drawfillbox (720, 550, 845, 570, 5) drawfillbox (665, 500, 790, 520, 5) drawfillbox (665, 400, 790, 420, 5) drawfillbox (720, 450, 845, 470, 5) for decreasing y : 200 .. 0 x := x + 1 Pic.Draw (sflake, x, y, picMerge) delay (35) end for loop getch (ch) if ch = right then counter := counter - 10 % Pic.Draw (box, counter + 10, 1, picCopy) elsif ch = chr (205) then counter := counter + 10 % Pic.Draw (box, counter - 10, 1, picCopy) end if Pic.Draw (box, counter, 1, picCopy) end loop Please specify what version of Turing you are using 4.1.1 |
Author: | TheGuardian001 [ Tue Jan 12, 2010 6:43 pm ] | ||
Post subject: | Re: moving a picture ... HELP | ||
Two options. cls, which will clear the screen entirely (not recommended since you aren't redrawing the boxes), and redrawing the pic over top of itself with picXor as the picture mode.
this will replace the area where the picture was with the current background colour. |
Author: | miller6 [ Wed Jan 13, 2010 11:11 am ] |
Post subject: | RE:moving a picture ... HELP |
i tried it and it just did the same thing but without the black outlining of the snowflake (sflake) |
Author: | Ktomislav [ Wed Jan 13, 2010 11:34 am ] |
Post subject: | Re: moving a picture ... HELP |
Porvide us with PICTURES you are using because we have to draw our own pictures to run the program..... It's not just you, it's the most of new members. |
Author: | miller6 [ Wed Jan 13, 2010 11:41 am ] |
Post subject: | Re: moving a picture ... HELP |
here is the snow flake |
Author: | miller6 [ Wed Jan 13, 2010 11:42 am ] |
Post subject: | Re: moving a picture ... HELP |
here is the sliding box |
Author: | Ktomislav [ Wed Jan 13, 2010 11:43 am ] | ||
Post subject: | Re: moving a picture ... HELP | ||
Use edit in the upper right corner of your post and don't double post... EDIT:It says <add your code here>, so why didn't you do so? You should add your code inside of the syntax tag. EDIT number 2: Now to your question.. You can clear your screen with cls procedure and after that write the whole screen again with new position of the sflake image. By doing it like this you will never do it.
I mean you are not making an animation.. If you want to make a game you need some physics. |
Author: | miller6 [ Wed Jan 13, 2010 6:22 pm ] |
Post subject: | Re: moving a picture ... HELP |
I actually am making a game. I am trying to make Brick Breaker |
Author: | Ktomislav [ Wed Jan 13, 2010 6:25 pm ] |
Post subject: | Re: moving a picture ... HELP |
I said you were doing it as if you were making an animation. I didn't say you were making an animation. I guess this misunderstanding is cause of not knowing the language. |
Author: | Turing_Gamer [ Wed Jan 13, 2010 10:32 pm ] | ||
Post subject: | Re: moving a picture ... HELP | ||
Then here is some code... I hope it will help. If you don't understand, post.
|