In my game player has to catch the eggs, so the eggs (which are made from `gameState.eggs = this.physics.add.group();`

) have a certain `velocity`

while on the ramp, but then once they’re off the ramp, i want to authomatically `setVelocity()`

to one with 0 for x coordinate, instead of just shooting across the screen.

Here’s my egg generating function:

```
function eggGen() {
let num = Math.random();
let xCoord, yCoord, eggDirection, eggAnimation, velocityX
if (num < .5) {
xCoord = 100;
eggDirection = 'eggLeft';
eggAnimation = 'rollingLeft'
velocityX = this.velocityX;
if (num < .25) {
yCoord = 232;
} else {
yCoord = 382;
}
} else {
xCoord = 700;
eggDirection = 'eggRight';
eggAnimation = 'rollingRight';
velocityX = -(this.velocityX)
if (num < .75) {
yCoord = 232;
} else {
yCoord = 382;
}
}
let egg = gameState.eggs.create(xCoord, yCoord, eggDirection).setVelocity(velocityX, this.velocityY).setScale(.6);
if (egg.x > 220 && egg.x < 580) {
egg.setVelocity(0, this.velocityY);
}
egg.anims.play(eggAnimation);
}
```

the last conditional is what i hoped would do the magic, but it doesn’t do anything.