Author Topic: Some limitations of platformers using pxl-test  (Read 26436 times)

0 Members and 2 Guests are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #45 on: March 15, 2012, 09:27:25 pm »
I am now back and have not had time to work this out, yet. (Also, I am distracted on the phone x.x) Still, I will try to figure this out <.<

As for limitations, all I can think of is memory. For systems with color screens, this is an extremely good system to use as you can generate scrolling maps easily and pack a few layers into each pixel.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #46 on: March 15, 2012, 09:59:07 pm »
A solution to the size issue is to use tile-based drawing, but pxl-test collision. That way, levels stay small and load fast, but you still get the precision of pxl-test collisions.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #47 on: March 15, 2012, 10:03:34 pm »
Yes, that is a great way and, also, enemies you just do by drawing their sprites to the layers.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #48 on: March 15, 2012, 10:12:11 pm »
So how can I fix the issue I had earlier, about the enemies not in the right place?

EDIT: BTW, my avatar is an NXT.
« Last Edit: March 15, 2012, 10:14:53 pm by nxtboy III »

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #49 on: March 16, 2012, 04:57:59 pm »
So, any luck with the enemy scrolling issue?
It might be because when the enemy's Y axis and the player's y velocity are subtracted for scrolling, since the enemy's y velocity is not a multiple of 64 or 32, the enemy's y axis rounds to a different number.

Hopefully that makes sense. :P
« Last Edit: March 16, 2012, 04:58:29 pm by nxtboy III »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #50 on: March 16, 2012, 05:01:17 pm »
Ooooh, so the code will round. I did not know that. Is there some way to prevent it from rounding?

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #51 on: March 16, 2012, 05:03:28 pm »
I was saying because, you cannot be at, for example, point(2.5,3.5). It's impossible to literally be at a fraction of a pixel point.
« Last Edit: March 16, 2012, 05:03:37 pm by nxtboy III »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #52 on: March 16, 2012, 05:06:14 pm »
Yeah, I know, and rounding will indeed throw it off. So does it round when you divide or when you tell it the coordinates. If it is at the coordinates, then there should be a command called int( or floor(, I am assuming. You will want to use that on the coordinates.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #53 on: March 16, 2012, 05:27:42 pm »
Yeah, there are floor and ceil functions. So I use floor when dividing by 64? (Hey that rhymes :P)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #54 on: March 16, 2012, 06:49:11 pm »
Yep :) And nice rhyme!

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #55 on: March 16, 2012, 06:53:18 pm »
I didn't even try to. :P
I used floor, and it still messes up! I think it is because since the enemy's Y axis (not multiple of 32 or 64) and player's y axis (also not multiple of 32 or 64) subtract/add (whatever they do), it goes to a different number for the enemy Y from the player Y.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #56 on: March 17, 2012, 05:36:16 pm »
So how can it be fixed?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #57 on: March 17, 2012, 05:46:03 pm »
I'm not sure, I haven't had time to put together a good example :/ I've never worked on a game where the player stayed in the same position XD

Pretty much, here is the best idea I have, but I think you are already doing it or have done it:

When you jump, you change the Y-offset of the viewing screen. Form there, just plot the enemies by doing this:

Compute the Y-Offset /64 with floor. Then compute the location of the enemies /64 with floor. THen just add the two to get the location on screen.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #58 on: March 17, 2012, 06:29:49 pm »
Yeah... That's what I'm doing. :P
I could make it so when the enemy hits a solid below (Stops moving), the enemy Y changes to a multiple of 64, then adds 32(since it's the middle of 64).
How do I do that, in code-like terms?

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #59 on: March 19, 2012, 06:09:46 pm »
So I need help fixing another problem:
The pxl-test stuff is checked in the graphic displaying part of the program. The pxl-test outputs (1 or 0) are saved to variables. When moving, it checks those variables for collision. However, they are not correct, because it checks the variables first, then uses pxl-test stuff and saves it to variables. So the variable checking is too early.
How do I fix it?
Here's some psuedo:

Game loop:
Moves player, checks collision using variables (V) (Lets call the variables V)
Displays graphics and uses pxl-test function and saves output to variables (variable V) it uses earlier
End game loop