level 9
问一个问题,在游戏窗口内,像红警一样,鼠标一直点击,再移动,在鼠标点击的位置到鼠标现在的位置(一直左键按下)画一个长方形。怎么达成?
2011年03月07日 09点03分
1
level 13
你应该能做到的一个办法是:在draw事件里响应鼠标的按下和放开时的判断
2011年03月07日 10点03分
2
level 8
按下,得到坐标1,移动,画框,放开,得到坐标2。然后碰撞检测。
2011年03月07日 11点03分
3
level 9
问题继续:
先谢谢楼上的回答,继续问个问题,为什么,再画框时,总是:
鼠标画,但是框的起步,总是向左移。
放上代码:
Information about object: draw
Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
Create Event:
execute code: ins_x=0
ins_y=0
set variable a to 0
Mouse Event for Glob Left Pressed:
execute code: ins_x=mouse_x
ins_y=mouse_y
set variable a to 1
Mouse Event for Glob Left Released:
set variable a to 0
Draw Event:
execute code: if a=1{
draw_rectangle_color(ins_x,ins_y,mouse_x,mouse_y,c_white,c_white,c_white,c_white,1)
}
2011年03月07日 11点03分
4
level 9
对不起啊,没有说清楚,相当于鼠标画框时,框的起步点,可鼠标的尖不一致,向左偏移了32像素。
2011年03月07日 12点03分
6
level 8
在我这边没有出现这种问题。
请问这个OBJ有没有受其他东西的影响。
2011年03月07日 12点03分
7