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

Username:   Password: 
 RegisterRegister   
 Need help with moving mouse graphic
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nezura




PostPosted: Sun May 02, 2004 3:02 pm   Post subject: Need help with moving mouse graphic

Hi, i can't seem to get the picture i drew with turing to follow the mouse around, took a picture of the graphic and put it in to the loop with a locate but it comes up with a maxrow error. Any help appreciated

Thanks in advance

code:


Draw.Oval(168,158,10,20,black)%leg 1
Draw.Oval(190,158,10,20,black)%leg 2
Draw.Oval(230,158,10,20,black)%leg 3
Draw.Oval(253,158,10,20,black)%leg 4
Draw.Line(268,211,295,240,black)%tail
Draw.FillOval(295,243,10,10,white)%tail ball
Draw.Oval(295,243,10,10,black)%tail outline
Draw.FillOval(165,143,9,5,black)%paw 1
Draw.FillOval(187,143,9,5,black)%paw 2
Draw.FillOval(227,143,9,5,black)%paw 3
Draw.FillOval(250,143,9,5,black)%paw 4


Draw.FillOval(200,200,70,30,white)%body
Draw.Oval(200,200,70,30,black)%body outline

Draw.FillOval(142,220,40,40,white)%head
Draw.Oval(142,220,40,40,black)%outline of head
Draw.Line(152,232,159,238,black)%right eye part 1
Draw.Line(159,238,165,232,black)%right eye part 2

Draw.Line(128,238,135,232,black)%left eye part 1
Draw.Line(128,238,122,232,black)%left eye part 2

Draw.FillOval(100,200,10,40,black)%left ear
Draw.FillOval(182,200,10,40,black)%right ear
Draw.Line(130,200,162,200,black)%mouth
Draw.FillArc(152,199,5,10,180,0,black)%tongue
Draw.Oval(143,215,7,7,black)%nose

var pic3:=Pic.New (89,137,306,261)
cls

function distance (x1, y1 : int) : int
    result abs (x1 - y1)
end distance

var x1, y1, x2, y2, mb : int := 320
y1 := 200
loop
    mousewhere (x2, y2, mb)
    if x2 > x1 then
        x1 += distance (x1, x2) div 10
    else
        x1 -= distance (x1, x2) div 10
    end if
    if y2 > y1 then
        y1 += distance (y1, y2) div 10
    else
        y1 -= distance (y1, y2) div 10
    end if

    locate(x1,y1)
    put pic3
 
    delay(10)
    cls
    View.Update
   
end loop
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Sun May 02, 2004 3:29 pm   Post subject: (No subject)

u forgot the offscreenonly
and u don't need the delay
and why don't u just use pic.draw?
like this:
code:

setscreen ("offscreenonly")
Draw.Oval(168,158,10,20,black)%leg 1
Draw.Oval(190,158,10,20,black)%leg 2
Draw.Oval(230,158,10,20,black)%leg 3
Draw.Oval(253,158,10,20,black)%leg 4
Draw.Line(268,211,295,240,black)%tail
Draw.FillOval(295,243,10,10,white)%tail ball
Draw.Oval(295,243,10,10,black)%tail outline
Draw.FillOval(165,143,9,5,black)%paw 1
Draw.FillOval(187,143,9,5,black)%paw 2
Draw.FillOval(227,143,9,5,black)%paw 3
Draw.FillOval(250,143,9,5,black)%paw 4


Draw.FillOval(200,200,70,30,white)%body
Draw.Oval(200,200,70,30,black)%body outline

Draw.FillOval(142,220,40,40,white)%head
Draw.Oval(142,220,40,40,black)%outline of head
Draw.Line(152,232,159,238,black)%right eye part 1
Draw.Line(159,238,165,232,black)%right eye part 2

Draw.Line(128,238,135,232,black)%left eye part 1
Draw.Line(128,238,122,232,black)%left eye part 2

Draw.FillOval(100,200,10,40,black)%left ear
Draw.FillOval(182,200,10,40,black)%right ear
Draw.Line(130,200,162,200,black)%mouth
Draw.FillArc(152,199,5,10,180,0,black)%tongue
Draw.Oval(143,215,7,7,black)%nose

var pic3:=Pic.New (89,137,306,261)
cls

function distance (x1, y1 : int) : int
    result abs (x1 - y1)
end distance

var x1, y1, x2, y2, mb : int := 320
y1 := 200
loop
    mousewhere (x2, y2, mb)
    if x2 > x1 then
        x1 += distance (x1, x2) div 10
    else
        x1 -= distance (x1, x2) div 10
    end if
    if y2 > y1 then
        y1 += distance (y1, y2) div 10
    else
        y1 -= distance (y1, y2) div 10
    end if

    Pic.Draw (pic3, x1, y1, picMerge)
  View.Update
    cls
 
   
end loop
Nezura




PostPosted: Sun May 02, 2004 3:49 pm   Post subject: (No subject)

wow I really appreciate the friendly people here...thank you for all your help Very Happy
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  [ 3 Posts ]
Jump to:   


Style:  
Search: