I need help with my code. I have tried to make a code but this won't work. could someone please try to help. I can't tell what it is!
if (document.getElementById("killer").style.marginLeft >
document.getElementById("player").style.marginLeft) {
alert("1");
};
if (document.getElementById("killer").style.marginLeft <
document.getElementById("player").style.marginLeft) {
alert("2");
};
Please help me!
Next Day...
Thank you guys for trying to help but I managed to get it done. I am very happy to see that so many people are willing to help new coders or just coders in need! I have just entered the community and I am very excited. This is the code.
setInterval(function (killer) {
if (document.getElementById("killer").style.marginLeft >
playerPositionX) {
alert("success!")
};
if (document.getElementById("killer").style.marginLeft <
playerPositionX) {
alert("error!")
};
}, 3000);
Hope it helps someone else in need.