Ask coding questions

← Back to all posts
delay??
CullenDAvello (18)

i have a function on lines 93 through 97 that i want to only run every second i have it so when the player touches the enemy he loses 1 health but its doing it wayyy to fast as soon as i touch the enemy i lose all my health
here's my game

Commentshotnewtop
malvoliothegood (255)

I have had this problem when making games using JavaScript. I have solved it by instantly moving the player away from the collision - it need not be by much.

Pythonier (303)

I'm pretty sure

delay(Milliseconds)

would work. So you could write something like:

delay(10)
// delays 1/100 of a second
CullenDAvello (18)

@CullenDAvello hey i tried that but i don't think i had my declaration set up right could you fork it for me