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

Username:   Password: 
 RegisterRegister   
 Trying to Locate Mouse Coordinates while having the Pic.Draw not covered up by lines or coordinates
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jaki723




PostPosted: Wed May 17, 2023 4:39 pm   Post subject: Trying to Locate Mouse Coordinates while having the Pic.Draw not covered up by lines or coordinates

What is it you are trying to achieve?
To try find coordinates of my button by finding mouse coordinates (mouseX,mouseY) and use these for future codes to get the buttons working

What is the problem you are having?
Since the things are drawn when I have the cords written it covers the screen as it goes on top.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:



%Starting Animation and Menu Screen
var titleX, titleY : int
titleX := 100
titleY := 200

proc title_animation
    Pic.Draw (sprite11, titleX, titleY, picCopy)
    titleY += 2
    View.Update
    delay (30)
end title_animation

Pic.Draw (backdrop1, 0, 0, picCopy)
Pic.Draw (sprite11, titleX, titleY, picCopy)
delay (1000)
cls
Pic.Draw (backdrop1, 0, 0, picCopy)

loop
    if titleY < 300 then
        title_animation
    end if
    exit when titleY >= 300
end loop
Pic.Draw (sprite12, 275, 225, picCopy)
Pic.Draw (sprite13, 247, 160, picCopy)
Pic.Draw (sprite14, 275, 95, picCopy)

var mouseX, mouseY, buttonDown : int
buttonDown := 0

loop
        Mouse.Where (mouseX, mouseY, buttonDown)
        put " ", mouseX, " ", mouseY %put mouse location
    View.Update
end loop



%Playing Music
%Music.PlayFile ("StartMenuMusic.mp3")




Please specify what version of Turing you are using
I'm using Turing 4.1.1
Sponsor
Sponsor
Sponsor
sponsor
scholarlytutor




PostPosted: Wed May 17, 2023 6:01 pm   Post subject: RE:Trying to Locate Mouse Coordinates while having the Pic.Draw not covered up by lines or coordinates

Can you repost the code with the variables (and anything else that's important) included? I've tried to run your code in Turing and I got several errors for missing variables.

This is unrelated to your question, but if you have variable names like sprite14, you probably need an array to hold all of your sprites.
jaki723




PostPosted: Wed May 17, 2023 8:34 pm   Post subject: Re: Trying to Locate Mouse Coordinates while having the Pic.Draw not covered up by lines or coordinates

I probably do need an array, but i figured the coordinate thing if by any chance you can help with making an array for my sprites please let me know and thanks.

The code should be there but if you also need images then let me know or you could just remove them from the script.



Cryptic Catacombs.t
 Description:

Download
 Filename:  Cryptic Catacombs.t
 Filesize:  2.43 KB
 Downloaded:  54 Time(s)

scholarlytutor




PostPosted: Thu May 18, 2023 5:55 pm   Post subject: RE:Trying to Locate Mouse Coordinates while having the Pic.Draw not covered up by lines or coordinates

Great! The array is pretty easy. Just replace your long line of sprite variables with this:

var Sprites : array 1 .. 14 of int

Then, when you assign pictures to each int, you do the following:

Sprites(1) := Pic.FileNew()
Sprites(2) := Pic.FileNew()
... and so on.

Hope that helps!
jaki723




PostPosted: Fri May 19, 2023 3:06 pm   Post subject: Re: Trying to Locate Mouse Coordinates while having the Pic.Draw not covered up by lines or coordinates

thx a lot thats actually really useful
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  [ 5 Posts ]
Jump to:   


Style:  
Search: