Computer Science Canada

Canging the Picture when key is pressed

Author:  nate [ Thu Apr 17, 2003 8:40 pm ]
Post subject:  Canging the Picture when key is pressed

I am using

View.Set ("offscreenonly")
var x,y :int
x:= 10
y :=10
loop

Input.KeyDown (blah)

if blah = ('a') then
x -= 10
end if

if blah = ('a') then
***HERE I WANT THE PIC THE PIC TO BE CHANGED BUT IT GETS All SHITTY WHEN I USE VIEW.UPDATE AGAIN WHEN I PUT IN A NEW PIC AND CLS THE OTHER. COUld SOMEONE HElP. I WANT IT TO PUT IN A NEW PIC AND CLEAR THE OlD one*** (no flashing crap)
x +10
end if


Pic.ScreenLoad ("1way.jpg", x,y, picMerge)

end loop


-Nate

Author:  Dan [ Thu Apr 17, 2003 9:52 pm ]
Post subject: 

this wroks for me and will work in most verisons of turing

code:

var pic1 : int := Pic.FileNew ("1way.bmp")
var blah:  string(1)

var x, y : int
x := maxx div 2
y := maxy div 2

loop
    Pic.Draw (pic1, x, y, 0)

    getch(blah)

    if blah = "a" then
        pic1 := Pic.FileNew ("2way.bmp")
    else
        pic1 := Pic.FileNew ("1way.bmp")
    end if
end loop


note that i toke out the view.set and chaged the mod in wich the picher is drawn.

Author:  Tony [ Thu Apr 17, 2003 10:52 pm ]
Post subject: 

since loading picture every time would not be efficient, you just take out the whole else part. Varaible will stay the same

Author:  Dan [ Thu Apr 17, 2003 11:50 pm ]
Post subject: 

yes you are righ, i was thinking of making it so it could swich back but i most have forgot and then left the elese in. Confused

Author:  nate [ Fri Apr 18, 2003 8:46 am ]
Post subject:  View.Set

But i need to use
view.set ("offscreenonly")

and

view.Update cause is stops the crazy flasin

-Nate

Author:  Blade [ Fri Apr 18, 2003 10:14 am ]
Post subject: 

then add it in


: