cannot convert int to floats... in an expression using only floats.

Started by bx83, Sat 17/07/2021 00:41:11

Previous topic - Next topic

bx83

Code: ags
vc[0] = Maths.Sqrt( Maths.RaiseToPower(Fcx-Ftmx, 2) + Maths.RaiseToPower(Fcy-Ftmy, 2) );


vc[] is an array of floats, all variables inside expression are floats, RaiseToPower is a floats-only function.

Error: Type mismatch: cannot convert 'int' to 'float'

???

Crimson Wizard

You already had a similar topic opened few days ago...

Maths.RaiseToPower

both arguments should be float, but your second argument is integer.

Khris

You need to write  2.0  here, a so-called float literal.

SMF spam blocked by CleanTalk