最基(la)础(ji)的gms2视口和物体(精灵)转动
lwys_4nothing 发表于 2019-04-06 10:21:12 370

水水更健康

tan、sin狂魔

灵感来自krzys-h的TheWholeWorldRevolving

obj_lol

Create事件

self.siner = 200
self.shakeamt = 0
self.shakelimit = 4 // 可更改
self.sleep = 0
self.initialangle = camera_get_view_angle(view_camera[view_current])
self.initialx = camera_get_view_x(view_camera[view_current])
self.initialy = camera_get_view_y(view_camera[view_current])
self.initialx2 = view_get_xport(view_current)
self.initialy2 = view_get_yport(view_current)

Begin Step (步开始) 事件

randomise()
self.sleep += sin(tan(0.5) * choose(0.1, 0.2, 0.3, 0.4, 0.5)) * 8
if (!(self.sleep >= 2)){
    return
}else{
    self.sleep = 0
}
cam = view_camera[view_current]
self.siner = (sin(sin(tan(0.5) * choose(0.1, 0.2, 0.3, 0.4, 0.5)) * 8) * (sin(tan(sin(random_range(413, 5000)) * choose(4, 8, 16, 24))))) * 128
self.siner += choose(0, 2, 3.1415, 4.13)
camera_set_view_angle(cam, sin(tan(sin(sin(cos(sin(camera_get_view_angle(cam) + 0.001125 * self.siner) * 4) * 2 * self.siner) * self.siner) * 4)) * 2 + (self.siner / 12))
if (self.shakeamt >= self.shakelimit/** && self.siner >= self.shakelimit / 5**/){
    camera_set_view_angle(cam, 0)
    camera_set_view_pos(cam, self.initialx, self.initialy)
    view_set_xport(view_current, self.initialx2)
    view_set_yport(view_current, self.initialy2)
    show_debug_message(camera_get_view_angle(cam))
    instance_destroy()
    return;
}else{
    self.shakeamt += 0.2
}
show_debug_message(self.shakeamt)
show_debug_message((self.shakeamt >= self.shakelimit ? "EXCEEDED LIMIT, SHOULD OVER" : "NOPE"))
show_debug_message(camera_get_view_angle(cam))

obj_rollobj

Create

self.shakedobj = self;
self.initangle = 0;
self.canshake = 0
self.siner = 200
self.shakeamt = 0
self.shakelimit = 12 // 可更改
self.sleep = 0

Begin Step

if (!self.canshake) return;
randomise()
self.sleep += sin(tan(0.5) * choose(0.1, 0.2, 0.3, 0.4, 0.5)) * 8
if (!(self.sleep >= 2)){
    return
}else{
    self.sleep = 0
}
self.siner = (sin(sin(tan(0.5) * choose(0.1, 0.2, 0.3, 0.4, 0.5)) * 8) * (sin(tan(sin(random_range(413, 5000)) * choose(4, 8, 16, 24))))) * 128
if (self.shakeamt >= self.shakelimit/** && self.siner >= self.shakelimit / 5**/){
    shakedobj.image_angle = self.initangle
    instance_destroy()
    return;
}else{
    self.shakeamt += 0.2
}
shakedobj.image_angle = sin(tan(sin(sin(cos(sin(shakedobj.image_angle + 0.001125 * self.siner) * 4) * 2 * self.siner) * self.siner) * 4)) * 2 + (self.siner / 12)

ok

最后于 2月前 被LiarOnce编辑 ,原因: 论坛是支持 GML 语法高亮的
最新回复 (2)
  • GM2_student 发表于 2019-04-08 11:27:23
    0 2
    支持
  • summer0f0 发表于 2019-05-18 10:37:31
    0 3
    请问有没有现成的文件,代码新手还不太会用