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

Username:   Password: 
 RegisterRegister   
 How do you click a picture and then click somewhere else for it to appear??
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mandyhuynh




PostPosted: Sat Jan 15, 2011 9:47 pm   Post subject: How do you click a picture and then click somewhere else for it to appear??

i dont know how to click one of my puzzle piece and that click on a specific area so that it will appear there too.
can someone help me by telling me wat to do?? my isp is due on this monday also.
thx



var mainWin : int := Window.Open ("position:300;500,graphics:700;500")
var heart, heart2 : int
var integerx, integery, rangex, rangey, button, button2 : int
integerx := Rand.Int (500, 550)
integery := Rand.Int (0, 350)
procedure r
drawfillbox (200, 100, 500, 400, 100)
Draw.Line (integerx, integery, integerx + 150, integery, black)
Draw.Line (integerx + 150, integery, integerx + 150, integery + 150, black)
Draw.Line (integerx + 150, integery + 150, integerx, integery + 150, black)
Draw.Line (integerx, integery + 150, integerx, integery, black)
Draw.Arc (integerx + 105, integery + 25, 70, 70, 50, 202, black)
Draw.Fill (integerx + 20, integery + 100, white, black)
Draw.Fill (integerx + 100, integery + 50, brightred, black)
heart := Pic.New (integerx, integery, integerx + 150, integery + 150)
heart2 := Pic.Mirror (heart)
Pic.Draw (heart2, 30, 100, picCopy)
loop
mousewhere (rangex, rangey, button)
if button = 1 then
if (rangex >= integerx and rangex <= integerx + 150) and (rangey >= integery and rangey <= integery + 150) then
mousewhere (rangex, rangey, button2)
if button2 = 1 then
if (rangex >= 200 and rangex <= 350) and (rangey >= 250 and rangey <= 400) then
Pic.Draw (heart, 200, 250, picCopy)
elsif (rangex >= 200 and rangex <= 350) and (rangey >= 100 and rangey <= 250) then
Pic.Draw (heart, 200, 100, picCopy)
elsif (rangex >= 350 and rangex <= 500) and (rangey >= 100 and rangey <= 250) then
Pic.Draw (heart, 350, 100, picCopy)
else
if (rangex >= 350 and rangex <= 500) and (rangey >= 250 and rangey <= 400) then
Pic.Draw (heart, 350, 250, picCopy)
end if
end if
end if
elsif (rangex >= 30 and rangex <= 180) and (rangey >= 100 and rangey <= 250) then
mousewhere (rangex, rangey, button2)
if button2 = 1 then
if (rangex >= 200 and rangex <= 350) and (rangey >= 250 and rangey <= 400) then
Pic.Draw (heart2, 200, 250, picCopy)
elsif (rangex >= 200 and rangex <= 350) and (rangey >= 100 and rangey <= 250) then
Pic.Draw (heart2, 200, 100, picCopy)
elsif (rangex >= 350 and rangex <= 500) and (rangey >= 100 and rangey <= 250) then
Pic.Draw (heart2, 350, 100, picCopy)
else
if (rangex >= 350 and rangex <= 500) and (rangey >= 250 and rangey <= 400) then
Pic.Draw (heart2, 350, 250, picCopy)
end if
end if
end if
end if
end if
end loop
end r
r
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Jan 15, 2011 9:54 pm   Post subject: RE:How do you click a picture and then click somewhere else for it to appear??

code:

loop
   mousewhere (rangex, rangey, button)
   if button = 1 then
      if (rangex >= integerx and rangex <= integerx + 150) and (rangey >= integery and rangey <= integery + 150) then
         mousewhere (rangex, rangey, button2)

Assuming that the mouse is clicked in the correct spot to get through all the if statements; how much time passes between first and second "Mouse.Where"?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
mandyhuynh




PostPosted: Sat Jan 15, 2011 11:03 pm   Post subject: Re: How do you click a picture and then click somewhere else for it to appear??

i still dont get it can you explain it in details
im only in grade 9
Tony




PostPosted: Sat Jan 15, 2011 11:45 pm   Post subject: RE:How do you click a picture and then click somewhere else for it to appear??

Did you not understand the question?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
mandyhuynh




PostPosted: Sun Jan 16, 2011 2:23 pm   Post subject: RE:How do you click a picture and then click somewhere else for it to appear??

i dont know how much time passes between the first two mousewhere
Tony




PostPosted: Sun Jan 16, 2011 2:28 pm   Post subject: RE:How do you click a picture and then click somewhere else for it to appear??

It was a leading question, trying to get you to think about the answer, and what that answer suggests about the rest of your program.

It doesn't have to be exact; fast/normal/slow will suffice. You can either reason about the code itself, or use some kind of output statements to figure this out experimentally.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: