camera schmoovin
This commit is contained in:
parent
bc06894859
commit
1e6aa9f530
12 changed files with 36 additions and 34 deletions
|
|
@ -27,7 +27,21 @@ if select && selectedunit == noone {
|
|||
//draw_text(global.gw-10, global.gh-10-i*20;
|
||||
}
|
||||
}
|
||||
if selectedunit == noone {
|
||||
hspd = lerp(hspd, (right-left)*((.1+stop*.1)*(ts.x)), .4);
|
||||
vspd = lerp(vspd, (down-up)*((.1+stop*.1)*(ts.y)), .4);
|
||||
x += hspd;
|
||||
y += vspd;
|
||||
|
||||
} else {
|
||||
hspd = 0;
|
||||
vspd = 0;
|
||||
x = lerp(x, selectedunit.x, .4);
|
||||
y = lerp(y, selectedunit.y, .4);
|
||||
}
|
||||
|
||||
global.camerax = x;
|
||||
global.cameray = y;
|
||||
var mousex = floor(mouse.x/global.tilesize.x);
|
||||
var mousey = floor(mouse.y/global.tilesize.y);
|
||||
//log(mousex, mousey);
|
||||
|
|
@ -42,15 +56,3 @@ if mousex < array_length(global.map) && mousex >= 0 {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(left){
|
||||
global.camerax--;
|
||||
}
|
||||
if(right){
|
||||
global.camerax++;
|
||||
}
|
||||
if(up){
|
||||
global.cameray--;
|
||||
}
|
||||
if(down){
|
||||
global.cameray++;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue