## Camera Shake? / Collisions / Enemies...

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Ryne
Party member
Posts: 444
Joined: Fri Jan 29, 2010 11:10 am

### Re: Camera Shake? / Collisions / Enemies...

Mud wrote:I love the look of your game. Did you do the sprites?
Thanks!, and yes, Everything you see is all me . I used to do draw a lot, so pixel art comes naturally. Actually, pixel art is easier, since you can be pixel-perfect with everything and if there is a mistake it usually just comes down to 1 or 2 pixels that need fixing. Although my zombies need complete fixing, I drew them at around 4am last night, and now that I look at them I'm not impressed...

I also went with the "cute" looks since cute + violence is oddly appealing.
@rynesaur
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Contact:

### Re: Camera Shake? / Collisions / Enemies...

Enemies? I can help with that. I wrote life. It's somewhere in projects if you want to look.

I can also help with their pathfinding, I've successfully implemented the A* algorithm before.
Ryne
Party member
Posts: 444
Joined: Fri Jan 29, 2010 11:10 am

### Re: Camera Shake? / Collisions / Enemies...

zac352 wrote:Enemies? I can help with that. I wrote life. It's somewhere in projects if you want to look.

I can also help with their pathfinding, I've successfully implemented the A* algorithm before.
Thats great! I can create and spawn an enemy just fine (as you can see in the demo) but I'm unsure on how to add multiple enemies. They won't spawn in random areas though, they will actually approach from the right off screen and walk towards the enemy. Any Ideas would be appreciated, I'm still wondering what's causing the issue in my last post.
@rynesaur
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Contact:

### Re: Camera Shake? / Collisions / Enemies...

Ryne wrote:
zac352 wrote:Enemies? I can help with that. I wrote life. It's somewhere in projects if you want to look.

I can also help with their pathfinding, I've successfully implemented the A* algorithm before.
Thats great! I can create and spawn an enemy just fine (as you can see in the demo) but I'm unsure on how to add multiple enemies. They won't spawn in random areas though, they will actually approach from the right off screen and walk towards the enemy. Any Ideas would be appreciated, I'm still wondering what's causing the issue in my last post.
What exactly do you need?
Ryne
Party member
Posts: 444
Joined: Fri Jan 29, 2010 11:10 am

### Re: Camera Shake? / Collisions / Enemies...

Ryne wrote: Also something weird is happening when I package the game as a .love file. The enemy approaches from the left instead of the right If I play directly from the folder. Even more odd is that if the .love file isn't in the same directory as the LOVE shortcut enemy approaches from the left, but if its in the same directory enemy approaches from the right. Is this happening for anyone else?
It's odd and its tickling my O.C.D.

As for the enemies, I'm not sure what I need since I'm unsure of an efficient way to create a horde. Ideally, I would like to be able to freely call as many zombies as I want to the field. I'm just wondering if it's easier than it seems :p
@rynesaur
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Contact:

### Re: Camera Shake? / Collisions / Enemies...

... That's really weird.
As for the enemies, I'm not sure what I need since I'm unsure of an efficient way to create a horde. Ideally, I would like to be able to freely call as many zombies as I want to the field. I'm just wondering if it's easier than it seems :p
I will work on it when I get home.
* Hording
* Spawning
Short list.
Ryne
Party member
Posts: 444
Joined: Fri Jan 29, 2010 11:10 am

### Re: Camera Shake? / Collisions / Enemies...

zac352 wrote:... That's really weird.
As for the enemies, I'm not sure what I need since I'm unsure of an efficient way to create a horde. Ideally, I would like to be able to freely call as many zombies as I want to the field. I'm just wondering if it's easier than it seems :p
I will work on it when I get home.
* Hording
* Spawning
Short list.
Awesome! Ill check it out after I sleep for 14 hours, Hopefully someone will be able to shed some light on my odd problem.
@rynesaur
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Camera Shake? / Collisions / Enemies...

What is the code that causes them to come from the one side or the other, exactly?
Ryne
Party member
Posts: 444
Joined: Fri Jan 29, 2010 11:10 am

### Re: Camera Shake? / Collisions / Enemies...

Robin wrote:What is the code that causes them to come from the one side or the other, exactly?
This is the only code that has to do with player location. It's what I'm currently to make the enemy follow the player.

Code: Select all

	if CheckCollision(player, enemy) == false then
enemy.x = enemy.x + (player.x - enemy.x) * (dt - 0.01)
enemy.y = enemy.y + (player.y - enemy.y) * (dt - 0.01)
end

@rynesaur
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Camera Shake? / Collisions / Enemies...

Three things:
1. Now I'm not sure what the issue was. Wasn't it the initial position of the enemy weird?
2. You could change the if-statement to if not CheckCollision(player, enemy) then. It works the same, but you're less likely to get odd looks from others. Perhaps if you rename the function to hasCollision or isCollision or so it will make more sense?
3. The enemy speed doesn't have an upper limit: the further they are away, the faster they will go. Off the top of my head, that will probably mean that:
1. You can't outrun the zombies. Ever.
2. Any horde will end up in one jumbling mess, since the ones at the back move faster than the ones in front.