Jump to content


kiznal

Member Since 02 Jul 2011
Offline Last Active Apr 29 2013 05:07 AM

Posts I've Made

In Topic: Beat-Em-Up Attack Problem

08 March 2013 - 05:55 AM

The first loop is for image_xscale = 1 (facing right) and the second loop is for image_xscale = -1 (facing left). That's why the second loop is subracting.
My sprite is about 16 px wide and is centered. I just clicked the spot on the sprite where the player attacked and it was a difference of 40 from the center of the sprite (68 px but center is at 28 px).

I'll try the collision line and see if that works. I probably wouldn't have thought of it. Thanks! :)

In Topic: Collision With A Wall Object: Player Goes Right In

06 March 2013 - 05:48 AM

I think you just need to make a collision mask for your player.

In Topic: Fps Example With Multiple Guns, Enemies

04 March 2013 - 05:46 AM

glad you guys liked it.

By weapon swap do you mean where you can hold 2 or 3 weapons at a time, like in Halo? I have an engine for that too. It's just that in this particular example, I was copying DOOM, where you can hold all the weapons you can find. But I might add it in...

for the punching script I just used the hitscan code from the original FPS example, I just limited the distance to 8 or something small like that. but it should go in the direction the player is facing... but I'll take a look.

In Topic: Enemies Not Chasing Correctly, And...

26 February 2013 - 12:53 AM

To stop the enemies from overlapping... maybe use mp_potential_step_object(Nally.x,Nally.y,speed,obj_enemy) ? Not too sure on this one. The enemies might act weird if since you're avoiding the same type. Idk. I usually avoid mp_potential_step stuff since A* algorithms are more powerful.

In Topic: Enemies Not Chasing Correctly, And...

26 February 2013 - 12:35 AM

Here's your code with some changes added. It should work for what you want.

if instance_exists(obj_ally_parent) {
var Nally; //if your Nally variable is set in the Create event or something, then delete this line of code. But if it's not, then you need this in here.
Nally = instance_nearest(x,y,obj_ally_parent);
//you shouldn't need to set the direction towards the Nally because the mp_potential_step should to that.

if distance_to_object(Nally) > 32 { //I believe this part is what you're looking for. This checks the distance from the enemy to the nally and if it's greater than 32, then it moves toward the nally.
mp_potential_step(Nally.x,Nally.y,speed,0);
}

image_angle = direction; //this should go AFTER the movement and directional code.

if distance_to_object(Nally) <=100 {
  if canshoot = 1 {
  instance_create(x,y,obj_Elaser); //no need for self.x or self.y since we're not referring to any other objects.
  canshoot = 0;
  //you might want to add an alarm here or something because right now the enemy can only shoot once. After can_shoot is set to 0, then there is no way of setting it back to one.
  }
}

}