Getting stuck in rules. Variables not updating.
djtackl
Member Posts: 10
I have player that is supposed to move to your mouse in an exponential decay type of momentum. (distanceToMouse/2)
The lagic staff from top to bottom in player:
Change Attribute: distanceToMouse to (distance to mouse using magnitude)
Rule:
If (distanceToMouse) > 50
move in direction: (vectorToAngle...) at speed of (distanceToMouse/2)
It never updates the distanceToMouse variable. Does gamesalad get stuck in rules? I thought the logic staff went through itself top to bottom forever.
Answers
Show all the function as you have it written. You can't show part of it like you have. That works under the assumption you did that part right and it may well be wrong.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
distanceToMouse: magnitude(game.Mouse.position.x-20-self.position.x, game.Mouse.position.y-20-self.position.y)
Point to mouse: vectorToAngle(self.position.x-game.Mouse.position.x-20, self.position.y-game.Mouse.position.y-20)-180
**
This is also happening to my spawner for enemies as well, it is supposed to keep repeating with the rule
It only spawns one enemy, then stops. Even if I set the value manually to 15+
Okay so I see an issue when doing math inside an expression you need to braket that off. The above is an invalid expression and therefore will not work.
Magnitude ((game.mouse.position.x -20)-self.position.x,(game.mouse.position.y-20)-self.position.y)
Point to mouse vectortoangle (self.position.x - (gamemouse.position.x-20),self.position.y - (game.mouse.position.y-20))-180
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Does gamesalad not follow PEMDAS?
Do you know how to fix the spawning issue?