ID:148317
 
Ok this is just for astetics... but I'm immitating a 3d windows button when clicked. The only problem is this code works, but not for the who png which is 96x32. It breaks it up into 32x32 squares depending where I click on it.
Does anyone know how I could make the entire PNG (96x32) image move instead of where it was clicked??

Click()
pixel_x = 2
pixel_y = -2
sleep(3)
pixel_x = 0
pixel_y = 0
LordJR wrote:
Ok this is just for astetics... but I'm immitating a 3d windows button when clicked. The only problem is this code works, but not for the who png which is 96x32. It breaks it up into 32x32 squares depending where I click on it.
Does anyone know how I could make the entire PNG (96x32) image move instead of where it was clicked??

Click()
pixel_x = 2
pixel_y = -2
sleep(3)
pixel_x = 0
pixel_y = 0

You'd have to change pixel_x and pixel_y for each of the 3 atoms making up the button. This is probably easiest done with a list, or some kind of link between segments, and by looping through them. One solution:
obj/interface
var/obj/interface/next
var/obj/interface/prev

New(newloc,obj/interface/P)
if(P)
prev=P
P.next=src

Del()
if(prev)
prev.next=null
spawn(-1) del(prev)
if(next)
next.prev=null
spawn(-1) del(next)
..()

button
proc/Action()

Click()
var/obj/interface/button/B
if(prev)
B=prev
while(B.prev) B=B.prev
return B.Click()
for(B=src,B,B=B.next)
B.pixel_x=2
B.pixel_y=-2
spawn(-1) Action()
sleep(2)
for(B=src,B,B=B.next)
B.pixel_x=0
B.pixel_y=0

This system could be expanded to have parent elements, perhaps a first child element and a link to a sibling, etc. The next/prev links will avoid using too many lists.

Lummox JR