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

Username:   Password: 
 RegisterRegister   
 moving a picture ... HELP
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
miller6




PostPosted: 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>

Turing:


<Add your code 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
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: 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.

code:

Pic.Draw(myPic,20,20,picCopy)
delay(100)
Pic.Draw(myPic,20,20,picXor)


this will replace the area where the picture was with the current background colour.
miller6




PostPosted: 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)
Ktomislav




PostPosted: 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.
miller6




PostPosted: Wed Jan 13, 2010 11:41 am   Post subject: Re: moving a picture ... HELP

here is the snow flake


sflake.gif
 Description:
 Filesize:  1.7 KB
 Viewed:  1572 Time(s)

sflake.gif


miller6




PostPosted: Wed Jan 13, 2010 11:42 am   Post subject: Re: moving a picture ... HELP

here is the sliding box


box.bmp
 Description:
 Filesize:  11.76 KB
 Viewed:  63 Time(s)

box.bmp


Ktomislav




PostPosted: 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.
Turing:
for decreasing y : 200 .. 0
x := x + 1
Pic.Draw (sflake, x, y, picMerge)
delay (35)
end for

I mean you are not making an animation.. If you want to make a game you need some physics.
miller6




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Ktomislav




PostPosted: 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.
Turing_Gamer




PostPosted: 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.
Turing:
var chars : array char of boolean
loop
    Input.KeyDown (chars)
    if chars ('a') then
        if x >= 0 then
            x := x - 5
        end if
    end if
    if chars ('d') then
        if x <= maxx - 20 then
            x := x + 5
        end if
    end if
    Draw.Box (x, 0, x + 20, 20)
end loop
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  [ 10 Posts ]
Jump to:   


Style:  
Search: