Wall collision for enemy [HELP ME]

M

Mathis

Guest
Hello I tried to make a wall collision for the enemy, I tested with all my knowledge :bash: but unfortunately I did not go out .. someone could explain to me how the code could be made thank you :) ! [I speak French]
 

3dgeminis

Member
Imagine you want to move the player object to the right, you would do something like this:
Code:
if keyboard_check(vk_right) {if !place_meeting(x+4,y,obj_wall) {x+=4}}
If the player is to the right of the enemy and he wants to chase him:
Code:
if x<obj_player.x {if !place_meeting(x+4,y,obj_wall) {x+=4}}
I'm sure you already have some code for the collisions of the player, there should be no problem using the same for another object.

I speak Spanish and use an online translator:)
 

Bentley

Member
If you post the code you currently have, the code about the enemy's movement and collision, I can probably help you better, as I can work with your approach, your variables names, etc.
 

Alix

Member
Salut Mathis, peux-tu poster ton code ici pour que nous puissions t'aider davantage ? Comme le code de mouvement du joueur/des ennemis.
Le code de collision pour les murs pour les ennemis devrait être sensiblement pareil à celui d'un joueur.
 
Top