Window Follow
Author |
Message |
Carey
|
Posted: Fri Mar 28, 2008 7:37 am Post subject: Window Follow |
|
|
Quick program that took like 2 minuts to make.
Turing: | %size of window
const hx := 100
const hy := 100
var mx, my, mb : int
var x, y := 10
var win := Window.Open ("graphics:" + intstr (hx * 2) + ";" + intstr (hy * 2) + ", position:0;0")
loop
Mouse.Where (mx, my, mb )
%remove the next line to evoke frustrated screams :)
exit when mb > 0
if mx not= hx or my not= hy then
x - = hx - mx
y - = hy - my
setscreen ("position:" + intstr (x ) + ";" + intstr (y ))
end if
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Sean
|
Posted: Fri Mar 28, 2008 11:58 am Post subject: Re: Window Follow |
|
|
It's an interesting program but if you click, it stops and you can't start it again.
Now, your challenge would be to fix that.
Other then that, I like it! |
|
|
|
|
|
DaveAngus
|
Posted: Fri Mar 28, 2008 12:07 pm Post subject: RE:Window Follow |
|
|
Really cool.
I like that.
And yes the whole clicking thing would be a good fix.
Also, maybe use that to make something within the run box.
So make an object follow it.
I'm not sure just trying to help you keep thinking about programs.
Good job none the less!
-Dave |
|
|
|
|
|
Sean
|
Posted: Fri Mar 28, 2008 12:53 pm Post subject: Re: Window Follow |
|
|
My bad, didn't notice the exit when I first took a look at it. |
|
|
|
|
|
SIXAXIS
|
Posted: Fri Mar 28, 2008 10:23 pm Post subject: Re: Window Follow |
|
|
I changed the code a bit so that to move the window you have to click and to exit you can press ALT+F4.
Turing: |
%size of window
const hx := 100
const hy := 100
var mx, my, mb : int
var chars : array char of boolean
var x, y := 10
var win := Window.Open ("graphics:" + intstr (hx * 2) + ";" + intstr (hy * 2) + ", position:0;0")
loop
Input.KeyDown (chars )
if chars (KEY_ALT ) and chars (KEY_F4 ) then
exit
end if
Mouse.Where (mx, my, mb )
if mb = 1 then
%remove the next line to evoke frustrated screams :)
if mx not= hx or my not= hy then
x - = hx - mx
y - = hy - my
setscreen ("position:" + intstr (x ) + ";" + intstr (y ))
end if
end if
end loop
|
Hope you don't mind I changed it Carey. |
|
|
|
|
|
BigBear
|
Posted: Sat Mar 29, 2008 8:45 am Post subject: Re: Window Follow |
|
|
I like how you click the x in the top corner to terminate program it just teleports and doesn't work.
You should close the window when alt-F4 is pressed. |
|
|
|
|
|
Carey
|
Posted: Mon Mar 31, 2008 12:05 pm Post subject: RE:Window Follow |
|
|
Ha. Ya it was fun to stick it in the startup folder with the exit line removed and watch my brother (not great with computers) try for about 10 minutes to close it, until i took pity on him and told him how to get to the task manager to shut it down.
@SIXAXIS nah i don't mind. Its cool your way too. maybe put it on a delay or something so when the user finally gets it to stop following the mouse and thinks they have won......They click the x and it teleports again ahh.......infinite doom and carnage Without the press alt-F4 of course > |
|
|
|
|
|
|
|