I'm currently programming my first game in JavaScript, and I've never technically learned JavaScript, I'm more fluent with Python.
Anyway, I need to find a way to make a list of all the pixels between two points on a straight horizontal line. I would then use the list to reference whether the user's character is touching any of the pixels to trigger a screen change.
It would be something like
pixels = []
(Function here to add the pixels to the list)
For pixel in pixels
If (dist(object.x, object.y, pixel.x, 0) < 1) {
object.x = start point on new screen
Object.y =
Does this make any sense? I'm sorry I'm bad at explaining things but I could use the help.