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

Username:   Password: 
 RegisterRegister   
 Crosshair over mouse...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Skizzarz




PostPosted: Wed Jan 07, 2004 4:50 pm   Post subject: Crosshair over mouse...

yo guys im making my summative and i want a crosshair over my mouse...I just cant seem to find how to declare the proper variables for the x and y coordinates of the mouse... heres the code so far:

code:
setscreen ("graphics:800;600")
setscreen ("nocursor")
var x,y,buttonnumber,buttonupdown,buttons:int
var nx,ny:int
const centerx:= maxx div 2
const centery:= maxy div 2
colorback (2)
loop
cls 
colorback (2)
drawfilloval (centerx, centery + 10, 5, 5, 66) % Defenders head
drawdot (centerx - 2,centery + 12,200)
drawdot (centerx + 2,centery + 12, 200)
drawline (centerx - 2, centery + 8, centerx + 2, centery + 8, 200)
drawfillbox (centerx + 5, centery + 5, centerx - 5, centery - 10, 32) % Defenders shirt
drawline (centerx - 15, centery - 7, centerx - 5, centery + 3, 32)% Defenders sleeve
drawline (centerx - 17, centery - 5, centerx - 5, centery + 5, 32)% Defenders sleeve
drawline (centerx - 16, centery - 6, centerx - 5, centery + 4, 32)% Defenders sleeve
drawline (centerx + 15, centery - 7, centerx + 5, centery + 3, 32)% Defenders sleeve
drawline (centerx + 17, centery - 5, centerx + 5, centery + 5, 32)% Defenders sleeve
drawline (centerx + 16, centery - 6, centerx + 5, centery + 4, 32)% Defenders sleeve
drawfillbox (centerx - 5, centery - 11, centerx - 1, centery - 30, 4 )%Defenders pants
drawfillbox (centerx + 5, centery - 11, centerx + 1, centery - 30, 4 )%Defenders pants
drawfillbox (centerx - 1, centery - 11, centerx + 1, centery - 15, 4 )%Defenders pants
drawfilloval (centerx - 4, centery - 30, 3, 2, 200 )%Defenders shoes
drawfilloval (centerx + 4, centery - 30, 3, 2, 200 )%Defenders shoes
drawfillbox (centerx - 18, centery - 5, centerx - 16, centery - 10, 28)%gun
drawfilloval (centerx - 20, centery - 4, 5, 1, 28) %gun
drawfilloval (centerx - 26, centery -4, 1, 1, 12)%gun
drawfillbox (centerx + 18, centery - 5, centerx + 16, centery - 10, 28)%gun
drawfilloval (centerx + 20, centery - 4, 5, 1, 28) %gun
drawfilloval (centerx + 26, centery -4, 1, 1, 12)%gun

drawfillbox (centerx + 35, centery + 25, centerx + 45, centery + 35, 90)
drawfillbox (centerx - 35, centery + 25, centerx - 45, centery + 35, 90)
drawfillbox (centerx + 35, centery - 40, centerx + 45, centery - 50, 90)
drawfillbox (centerx - 35, centery - 40, centerx - 45, centery - 50, 90)
drawfillbox (centerx - 5, centery - 40, centerx + 5, centery - 50, 90)
drawfillbox (centerx + 5, centery + 25, centerx - 5, centery + 35, 90)
drawfillbox (centerx - 35, centery - 2, centerx - 45, centery - 12, 90)
drawfillbox (centerx + 35, centery - 2, centerx + 45, centery - 12, 90)
drawfillbox (centerx + 25, centery + 25, centerx + 15, centery + 35, 90)
drawfillbox (centerx - 25, centery + 25, centerx - 15, centery + 35, 90)
drawfillbox (centerx + 15, centery - 40, centerx + 25, centery - 50, 90)
drawfillbox (centerx - 15, centery - 40, centerx - 25, centery - 50, 90)
drawfillbox (centerx + 35, centery - 22, centerx + 45, centery - 32, 90)
drawfillbox (centerx + 35, centery + 6, centerx + 45, centery + 16, 90)
drawfillbox (centerx - 35, centery - 22, centerx - 45, centery - 32, 90)
drawfillbox (centerx - 35, centery + 6, centerx - 45, centery + 16, 90)


drawbox (centerx + 34, centery + 24, centerx + 44, centery + 34, 6)
drawbox (centerx - 34, centery + 24, centerx - 44, centery + 34, 6)
drawbox (centerx + 34, centery - 39, centerx + 44, centery - 49, 6)
drawbox (centerx - 34, centery - 39, centerx - 44, centery - 49, 6)
drawbox (centerx - 4, centery - 39, centerx + 4, centery - 49, 6)
drawbox (centerx + 4, centery + 24, centerx - 4, centery + 34, 6)
drawbox (centerx - 34, centery - 1, centerx - 44, centery - 11, 6)
drawbox (centerx + 34, centery - 1, centerx + 44, centery - 11, 6)
drawbox (centerx + 24, centery + 24, centerx + 14, centery + 34, 6)
drawbox (centerx - 24, centery + 24, centerx - 14, centery + 34, 6)
drawbox (centerx + 14, centery - 39, centerx + 24, centery - 49, 6)
drawbox (centerx - 14, centery - 39, centerx - 24, centery - 49, 6)
drawbox (centerx + 34, centery - 21, centerx + 44, centery - 31, 6)
drawbox (centerx + 34, centery + 5, centerx + 44, centery + 15, 6)
drawbox (centerx - 34, centery - 21, centerx - 44, centery - 31, 6)
drawbox (centerx - 34, centery + 5, centerx - 44, centery + 15, 6)




buttonwait ("down",x,y,buttonnumber,buttonupdown)
nx:=x
ny:=y
var s : int := 1000
loop
cls
if nx < centerx then
drawline (centerx - 26,centery - 4,nx,ny,12)
elsif nx > centerx then
drawline (centerx + 26,centery - 4,nx,ny,12)
end if

drawfilloval (centerx, centery + 10, 5, 5, 66) % Defenders head
drawdot (centerx - 2,centery + 12,200)
drawdot (centerx + 2,centery + 12, 200)
drawfilloval (centerx, centery + 8, 3,1,200)
drawfillbox (centerx + 5, centery + 5, centerx - 5, centery - 10, 32) % Defenders shirt
drawline (centerx - 15, centery - 7, centerx - 5, centery + 3, 32)% Defenders sleeve
drawline (centerx - 17, centery - 5, centerx - 5, centery + 5, 32)% Defenders sleeve
drawline (centerx - 16, centery - 6, centerx - 5, centery + 4, 32)% Defenders sleeve
drawline (centerx + 15, centery - 7, centerx + 5, centery + 3, 32)% Defenders sleeve
drawline (centerx + 17, centery - 5, centerx + 5, centery + 5, 32)% Defenders sleeve
drawline (centerx + 16, centery - 6, centerx + 5, centery + 4, 32)% Defenders sleeve
drawfillbox (centerx - 5, centery - 11, centerx - 1, centery - 30, 4 )%Defenders pants
drawfillbox (centerx + 5, centery - 11, centerx + 1, centery - 30, 4 )%Defenders pants
drawfillbox (centerx - 1, centery - 11, centerx + 1, centery - 15, 4 )%Defenders pants
drawfilloval (centerx - 4, centery - 30, 3, 2, 200 )%Defenders shoes
drawfilloval (centerx + 4, centery - 30, 3, 2, 200 )%Defenders shoes
drawfillbox (centerx - 18, centery - 5, centerx - 16, centery - 10, 28)
drawfilloval (centerx - 20, centery - 4, 5, 1, 28)
drawfilloval (centerx - 26, centery -4, 1, 1, 12)
drawfillbox (centerx + 18, centery - 5, centerx + 16, centery - 10, 28)
drawfilloval (centerx + 20, centery - 4, 5, 1, 28)
drawfilloval (centerx + 26, centery -4, 1, 1, 12)
drawfillbox (centerx + 35, centery + 25, centerx + 45, centery + 35, 90)
drawfillbox (centerx - 35, centery + 25, centerx - 45, centery + 35, 90)
drawfillbox (centerx + 35, centery - 40, centerx + 45, centery - 50, 90)
drawfillbox (centerx - 35, centery - 40, centerx - 45, centery - 50, 90)
drawfillbox (centerx - 5, centery - 40, centerx + 5, centery - 50, 90)
drawfillbox (centerx + 5, centery + 25, centerx - 5, centery + 35, 90)
drawfillbox (centerx - 35, centery - 2, centerx - 45, centery - 12, 90)
drawfillbox (centerx + 35, centery - 2, centerx + 45, centery - 12, 90)
drawfillbox (centerx + 25, centery + 25, centerx + 15, centery + 35, 90)
drawfillbox (centerx - 25, centery + 25, centerx - 15, centery + 35, 90)
drawfillbox (centerx + 15, centery - 40, centerx + 25, centery - 50, 90)
drawfillbox (centerx - 15, centery - 40, centerx - 25, centery - 50, 90)
drawfillbox (centerx + 35, centery - 22, centerx + 45, centery - 32, 90)
drawfillbox (centerx + 35, centery + 6, centerx + 45, centery + 16, 90)
drawfillbox (centerx - 35, centery - 22, centerx - 45, centery - 32, 90)
drawfillbox (centerx - 35, centery + 6, centerx - 45, centery + 16, 90)


drawbox (centerx + 34, centery + 24, centerx + 44, centery + 34, 6)
drawbox (centerx - 34, centery + 24, centerx - 44, centery + 34, 6)
drawbox (centerx + 34, centery - 39, centerx + 44, centery - 49, 6)
drawbox (centerx - 34, centery - 39, centerx - 44, centery - 49, 6)
drawbox (centerx - 4, centery - 39, centerx + 4, centery - 49, 6)
drawbox (centerx + 4, centery + 24, centerx - 4, centery + 34, 6)
drawbox (centerx - 34, centery - 1, centerx - 44, centery - 11, 6)
drawbox (centerx + 34, centery - 1, centerx + 44, centery - 11, 6)
drawbox (centerx + 24, centery + 24, centerx + 14, centery + 34, 6)
drawbox (centerx - 24, centery + 24, centerx - 14, centery + 34, 6)
drawbox (centerx + 14, centery - 39, centerx + 24, centery - 49, 6)
drawbox (centerx - 14, centery - 39, centerx - 24, centery - 49, 6)
drawbox (centerx + 34, centery - 21, centerx + 44, centery - 31, 6)
drawbox (centerx + 34, centery + 5, centerx + 44, centery + 15, 6)
drawbox (centerx - 34, centery - 21, centerx - 44, centery - 31, 6)
drawbox (centerx - 34, centery + 5, centerx - 44, centery + 15, 6)






for i : 1..15
sound ( s , 15 )
s := s - 40
end for
exit when buttonmoved ("up")
mousewhere (nx,ny,buttons)
 
end loop
buttonwait ("up", nx,ny,buttonnumber,buttonupdown)
 
end loop
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: Wed Jan 07, 2004 6:09 pm   Post subject: (No subject)

i did something like this before..let me see if a remember correctly

code:

var x,y,button:int

loop
Mouse.Where(x,y,button)
drawoval(x,y,x,y,10)
end loop


play around with that, instead of drawoval...use w/e you are using for a crosshair, if no one has posted a better solution by the time i get to the other comp, ill post you what i used for a crosshair and how i made it follow the mouse
Skizzarz




PostPosted: Wed Jan 07, 2004 6:10 pm   Post subject: (No subject)

thanks man i'll see if i can make it work.
Thuged_Out_G




PostPosted: Wed Jan 07, 2004 6:15 pm   Post subject: (No subject)

sorry i cant be of more help, but i dont have turing on this comp lol...so i didnt wanna put alot of effort into, just for it not to work Embarassed lol
Skizzarz




PostPosted: Wed Jan 07, 2004 6:22 pm   Post subject: (No subject)

well...it works as a separate program but... because its a loop as soon as i get to it in my game... it wont get out of it (because its a cont. loop obviosly) how do i get around this? Confused
Skizzarz




PostPosted: Wed Jan 07, 2004 7:54 pm   Post subject: (No subject)

please... anyone answer my question....
Skizzarz




PostPosted: Wed Jan 07, 2004 8:42 pm   Post subject: (No subject)

PLEASE SOMEONE POST! ANYONE! IF YOU DONT SOON THIS PUPPY IS GOING TO DIE! DO YOU REALLY WANT HIM TO DIE? lol

damnit...i dont know how to insert pics... meh...[img][/img][/url]
Dan




PostPosted: Wed Jan 07, 2004 10:26 pm   Post subject: (No subject)

you cant put a pic or draw somting "over" the mouse but you can close on under it.

you need to use mousewhere and a code like Thuged_Out_G showed you.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor
Sponsor
sponsor
Skizzarz




PostPosted: Thu Jan 08, 2004 12:22 pm   Post subject: (No subject)

lol, did u read my post after thuged out g? cuz i already got the cursor goin but i need to know where to put the code so it wil run when my pogram is running.
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  [ 9 Posts ]
Jump to:   


Style:  
Search: