Discuss and collaborate on GML scripts

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Shadowblitz16****Member**- Registered: 2016-01-30
- Posts: 3

can someone help me

my script seems to be giving me a division by zero error

I got the formula from a irc and I don't know really know how it works

```
///move_reflect(obj)
vx = argument0.x
vy = argument0.y
lx = lengthdir_x(argument0.speed,argument0.direction)
ly = lengthdir_y(argument0.speed,argument0.direction)
dx = 2 * (vx * lx + vy * ly) / (lx * lx + lx * lx) * lx - vx
dy = 2 * (vx * lx + vy * ly) / (lx * lx + lx * lx) * ly - vy
motion_add(point_direction(vx,vy,dx,dy),argument0.speed)
```

I'm trying to make an alternative bounce script since the move_bounce functions are buggy and don't work right

Offline

Pages: **1**