Jump to content

jvas

Members
  • Posts

    450
  • Joined

  • Last visited

Posts posted by jvas

  1. On 2/6/2023 at 10:28 PM, LarsImNetz said:

    Just a new demo of my implementation of Night Knight, shows the design of the other stages and more sprites.

    Congratulations for the good choice of colors, nice character design and fluent movement!

  2. 58 minutes ago, shanti77 said:

    The Amiga version looks like the Atari version, even the ZxSpectrum game can look better. On 16 bits, the game should have more colors and better animation, you can compare it with Ruff'n'Tumble, for example.

    It is said, that "it's just an early working version"

  3. I found these two articles:

    1.  Check if a point is inside a polygon: https://www.geeksforgeeks.org/how-to-check-if-a-given-point-lies-inside-a-polygon/

    2.  Which is based on  the algorythm of determinig of the intersection of two segments: https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/

     

    1. We treat the objects in the game as points. For example we can say, that if the center of an object is looped then the object itself is looped. 
    2. We can determine if a new loop is created. Only in this case we have to go on. In the video it seems that not only intersections but when two points next to each other also creates a loop:
      1. The coordinates of the head is the same as one of the other point of the snake
      2. Or the coordinates of the head is next to the one of the other point of the snake
    3. We can separate all points of the "snake" which are part of a loop (need to find out how, more than one loops are possible):
      These are all points from the head toward the tail till we reach the point determined in #2

    The 1st algorithm becames simple them:

    An object is in a loop, if there are odd number of snake points (determined in #3) whose x coordinate is bigger then the object's x coordinate and the y coordinate is the same as the object's y coordinate

     

    There are some tough cases like this:

    image.png.131f9b4d8647baafa13441fac9262ab5.png

  4. First thought:

     

    For the tail I would maintain 2 ordered lists:

    - the first list would contain the points (coordinates) in which the head changes direction

    - the second list would contain the ordered list of direction changes

     

    This way we can "play back" the movement of the head: 

    1. the tail starts from the last point (and removes it from the list)

    2. and starts moving in the direction that is at the last position of the directions' list (and removes it)

    3. it moves till it reaches the last coordinates in the points' list (or reaches the head's position if nothing in the list) and go back to step one

     

    Seems simple, but needs a buffer management with the length of the buffer, first and last position. We can use the list of points (with the position of the head and tail) to check which is inside the polygon or is it a closed polygon at all.

×
×
  • Create New...