Fangames > Programming Questions

Invincibility Frames

<< < (5/6) > >>

LoneTree_tv:
Thanks  :atkHappy:

I also wanted to know how to make cherries rotate around the boss, but I scratched the idea as a whole. It'd still be nice to know how, if you know.

Katz:

--- Quote from: LoneTree_tv on August 03, 2015, 03:19:25 PM ---Thanks  :atkHappy:

I also wanted to know how to make cherries rotate around the boss, but I scratched the idea as a whole. It'd still be nice to know how, if you know.

--- End quote ---

I would do either paths or move_towards_point code(s) with a 360 rotation

I guess the first one works better if math is hard :P

LoneTree_tv:
Math is ezpz, and I don't know how to use paths :P

But how would that work in code?

with deliciousFruit {
move_towards_point(boss.x,boss.y,90) }

?

Derf:
off the top of my head something like this

make a special fruit object:


--- Code: ---CREATE EVENT:
cx = boss.x
cy = boss.y
rad = 12; //or whatever you want the radius to be
spd = 8;//or whatever you want the rotational speed to be
ang = 90;//or whatever you want the starting ang of the object to be
--- End code ---


--- Code: ---STEP EVENT:
ang = ang mod 360;//this makes it so that the ang is always between 0 & 360

if(ang < 0) {
     ang += 360;
}

x = cx + rad * cos(degtorad(ang)); //make sure cherry is at correct point in rotation
y = cy - rad * sin(degtorad(ang));

ang += spd; //rotate cherry

cx = boss.x;
cy = boss.y; //update the centre points so that if your boss is moving, the cherries move with it

--- End code ---

LoneTree_tv:
That looks incredibly complicated.
Also, you didn't use the move_towards_point thing, telling me there's probably a different method? I'd like to know just in case. Thanks :atkHappy:

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version