| 170 | _did_collide_with_entity(other) {} |
| 171 | |
| 172 | _draw_model() { |
| 173 | this._anim_time += game_tick; |
| 174 | |
| 175 | // Calculate which frames to use and how to mix them |
| 176 | let f = (this._anim_time / this._anim[0]), |
| 177 | mix = f - (f|0), |
| 178 | frame_cur = this._anim[1][(f|0) % this._anim[1].length], |
| 179 | frame_next = this._anim[1][((f+1)|0) % this._anim[1].length]; |
| 180 | |
| 181 | // Swap frames if we're looping to the first frame again |
| 182 | if (frame_next < frame_cur) { |
| 183 | [frame_next, frame_cur] = [frame_cur, frame_next]; |
| 184 | mix = 1-mix; |
| 185 | } |
| 186 | r_draw( |
| 187 | this.p, this._yaw, this._pitch, this._texture, |
| 188 | this._model.f[frame_cur], this._model.f[frame_next], mix, |
| 189 | this._model.nv |
| 190 | ); |
| 191 | } |
| 192 | |
| 193 | _spawn_particles(amount, speed = 1, model, texture, lifetime) { |
| 194 | for (let i = 0; i < amount; i++) { |