Fangames > Programming Questions
Invincibility Frames
Katz:
I 100% recommend derf's method in this instance. move_towards_point would just be simple and shitty imo.
LoneTree_tv:
alright then. Thanks :atkHappy:
Derf:
You only really need to mess with the create event variables to tweak it to fit your game so it shouldn't matter if you don't understand it 100%.
Generally there are more than one way of doing most things in Game Maker and it's just up to personal preference and optimization really.
infern0man1:
A while back sand wrote this script for orbiting, I hope he won't mind I put it here:
--- Code: (orbit) ---argument0=centerX; //the center x-coordinate for the orbit
argument1=centerY; //the center y-coordinate for the orbit
argument2=radius;
argument3=spinSpeed; //the speed the projectile is moving in the orbit
argument4=direction;
argument5=radiusSpeed; //the speed the projectile is moving along the radius (a speed of -1 would make the projectile move inwards)
x=centerX+lengthdir_x(radius+rad,direction+dir);
y=centerY+lengthdir_y(radius+rad,direction+dir);
dir+=spinSpeed;
rad+=radiusSpeed;
--- End code ---
And in the projectile's step event:
--- Code: ---orbit(centerX,centerY,radius,spinSpeed,direction,radiusSpeed);
--- End code ---
You could set the defaults in the projectile's step event, but for me, when I set the spinSpeed in the step event, the projectiles will just speed up until it hits a certain speed, then slow back down, as if it were a sine wave. To avoid this, I usually just put in either a spawning object's alarm[_] event or the boss's alarm[_] event:
--- Code: ---for(i=0;i<360;i+=360/[number]){
a=instance_create([x value],[y value],cherry);
a.centerX=a.xstart;
a.centerY=a.ystart;
a.radius=[number];
a.spinSpeed=[number];
a.direction=i;
a.radiusSpeed=[number];
}
--- End code ---
If you don't want the projectiles to move in towards the orbit's center, you can remove rad and radiusSpeed from each code or just set it radiusSpeed to 0.
Navigation
[0] Message Index
[*] Previous page
Go to full version