Strange things about moving object

BlitzPlus Forums/BlitzPlus Programming/Strange things about moving object

Valgar(Posted 2004) [#1]
Hallo to all.
I have a problem with my movements function.
I have tried to modify my functions with the various hint from my previous posts(about the function that return multiple values...)but when i execute my program...something goes very wrong.
I have 3 function that made different movements:up&down,left&right,circular.
Here's the code.....i don't know how to explayn the effects,but if you cut&paste the code and you press the mouse button....well.....i don't know why the speed movements double itself!!!




I can call crea_alieno many times,but if i call crea_alieno with the same movement function.....it seems that the alien add their speed and go at speed=alien1speed+alien2speed
I also don't know if the position are correctly calculated.....
I hope i have translated well,and that the effect i'm trying to explain is visible to all.
Thanks


Valgar(Posted 2004) [#2]
I think i have individuated the error!!!
I have to declare the variable that control the angle INTO the type!
Else at every call to a function the angle sum itself with the precedent angle...argh
Here's the correct function:



(a question:what's the forum command to highlight the code in green?)

(edited:i have found the command :P )

I hope that is the definitive version.


bobbo(Posted 2004) [#3]
Glad that you fixed it by yourself :)
It seems I am not the only Italian here :)

Ciao!


Valgar(Posted 2004) [#4]
Ciao anche a te!
It's easy for me to make error in such things,because i don't know what must be inside and what outside the type o_O