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

Username:   Password: 
 RegisterRegister   
 Sheep Herding
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GregLP




PostPosted: Tue Oct 25, 2005 6:14 pm   Post subject: Sheep Herding

code:

var x : int := maxx
var y : int := maxy
var x2 : int
var y2 : int
var mousex : int := round (maxx / 2)
var mousey : int := round (maxy / 2)
var button : int

randint (x2, 1, maxx)
randint (y2, 1, maxy)

var sheep := Window.Open ("graphics:1;70")
var picID := Pic.FileNew ("sheep.jpeg")
Pic.Draw (picID, 1, 35, picCopy)
var target := Window.Open ("graphics:161;160")

var picIDtarget := Pic.FileNew ("Target.jpg")
Pic.Draw (picIDtarget, 0, 0, picCopy)



Window.SetPosition (target, x2, y2)

loop
    delay (7)
    Window.SetPosition (sheep, x, y)
    Mouse.Where (mousex, mousey, button)
    if mousex > x and mousey > y then
        x -= 2
        y -= 2
    elsif mousex > x and mousey < y then
        x -= 2
        y += 2
    elsif mousex < x and mousey > y then
        x += 2
        y -= 2
    elsif mousex < x and mousey < y then
        x += 2
        y += 2
    end if
    exit when x >= x2 - 20 and x <= x2 + 20 and y - 20 >= y2 - 20 and y - 20 <= y2 + 20
end loop

put "You win!!!"


Nowhere near done, procedures, intro, conclusion, music, sound fx to come!

A little bit of fun here. The one thing I need help on is making the "sheep" window smaller so all you really see is the sheep and not all the white space. Turing doesn't seem to let me make the window any smaller.

I'd also like some ideas for how to make a more "sheep like" movement that is not so linear (ooh big word!)

Comments are definitely welcome!



Pics.zip
 Description:
The pics, add them in the same file as the code above, you'll need to save the code above to a folder and zip the pics to it

Download
 Filename:  Pics.zip
 Filesize:  5.81 KB
 Downloaded:  87 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Oct 25, 2005 7:54 pm   Post subject: (No subject)

to make the window smaller, you might have to remove the bar with control buttons turing places. Check out View.Set(), there got to be an option for removing that part.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: