More Near more power
Ok thank you very much the first i have to say, i`m learning alot of things with us.
Now i`m trying for 2 hours how to change something:
max(min(magnitude( self.Position.X - game.Mouse.Position.X , self.Position.Y - game.Mouse.Position.Y ),300),0)*2
The original is:
max(0,min(magnitude( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y ),300))*2 (when more near less power)
I want to make more power while more near I'm
But i cant do it!!
I have read it that:http://cookbook.gamesalad.com/question/4e21695fdb04ec688c000019
Now i`m trying for 2 hours how to change something:
max(min(magnitude( self.Position.X - game.Mouse.Position.X , self.Position.Y - game.Mouse.Position.Y ),300),0)*2
The original is:
max(0,min(magnitude( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y ),300))*2 (when more near less power)
I want to make more power while more near I'm
But i cant do it!!
I have read it that:http://cookbook.gamesalad.com/question/4e21695fdb04ec688c000019
Comments
power=(maxMagnitude-magnitude)/maxMagnitude*powerFactor
Where maxMaxnitude is 600 and powerFactor is say, 100.
That takes the percentage distance and multiplies it by a factor.
(600-( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y ))/600*100
Dont work i think with that or i have missed something
Hi @mrpacogp
You forgot the magnitude expression. Also, a bit more explanation based on info from @tatiang :
Let's say the maximum power at the centre of the object you get close to is 600. Then you have to decide at what magnitude distance from this point the 0 point is, i.e where the start of adding power is. For an example, lets call that 300. So the power factor in this case, is 2.
Change Attribute Power to (300-(magnitude(game.Mouse.Position.X-self.Position.X, game.Mouse.Position.Y-self.Position.Y))*2)
See if that works now.
Just thought: you need to add, based on the above example, (changing numbers accordingly) a condition when it can start:
---make real attribute called Mag
Rule: When mouse is down
change (--or-- constrain) attribute Mag to magnitude(game.Mouse.Position.X-self.Position.X, game.Mouse.Position.Y-self.Position.Y)
Rule: --- nested--- When Mag < 300
Change Attribute Power to (300-Mag)*2
Sometimes we stop on some point for something easy and dont see the light jejeje
Thank you all people for this support.