Java 2D Platformer Tutorial #9 - Starting the Map Class

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • Check out my new Kotlin tutorial series: • Video Hey guys! In this video we make the Map class!

КОМЕНТАРІ • 10

  • @robcurley8909
    @robcurley8909 6 років тому +1

    Really long post-mortem now but the reason you struggled was from the design of the Player class - on creation it simply sets its x and y to half of the GamePanel's width and height inside of the constructor. Hopefully future viewers find this helpful.

  • @togmeister8604
    @togmeister8604 10 років тому +3

    The paremeter of the player's constructor is width, height you are entering 0 and -100 and you thought it was x, y not width, height.

  • @Monkexxx
    @Monkexxx 7 років тому

    at 10 mins, I have a problem im player... //right
    if(Collision.playerBlock(new Point(iX + width + (int)GameState.xOffset, iY + (int)GameState.yOffset + 2), b[1])
    || Collision.playerBlock(new Point (iX + width + (int)GameState.xOffset, iY + height + (int)GameState.yOffset - 1), b[i][j])) {
    right = false;
    the player Block at the top is wrong.

    • @theYouTubeClipsR
      @theYouTubeClipsR Рік тому

      after 5 years I'm here to help.
      if(Collision.playerBlock(new Point(iX + width + (int)GameState.xOffset, iY + (int)GameState.yOffset + 2), b[I][j])
      || Collision.playerBlock(new Point (iX + width + (int)GameState.xOffset, iY + height + (int)GameState.yOffset - 1), b[i][j])) {
      right = false;
      }

  • @vladimirchiyluk9796
    @vladimirchiyluk9796 10 років тому

    how come you dont have way more like? nice vid bro.

  • @zahhy1mohhy140
    @zahhy1mohhy140 6 років тому

    completely failed me. the player just falls through every thing

    • @extraterrestrialbug5095
      @extraterrestrialbug5095 3 роки тому

      I know this is a very old comment and you probably have already solved it. But, anyway, if someone else has this problem, it might be because of the line:
      topCollision = false;
      Check if you put it in the right place. It should stay *outside* of the for loops.

  • @philip4902
    @philip4902 8 років тому

    sorry if this is too late but when you paused the video to figure out what was wrong when you played it again I did what you did and my player goes invisible/blank.
    Please Help Me...

    • @jonathanpersgarden8216
      @jonathanpersgarden8216 8 років тому

      +Philip Anderson have you set negative values in the player constructor as pj did, because those are the size of the player and should be positive :)

    • @philip4902
      @philip4902 8 років тому

      +Jonathan Persgarden ok I did that and now I get an error:
      Exception in thread "Thread-1" java.lang.NullPointerException
      at com.philip.platformer.physics.Collision.playerBlock(Collision.java:10)
      at com.philip.platformer.entities.Player.tick(Player.java:46)
      at com.philip.platformer.gamestate.Level1State.tick(Level1State.java:33)
      at com.philip.platformer.gamestate.GameStateManager.tick(GameStateManager.java:17)
      at com.philip.platformer.main.GamePanel.tick(GamePanel.java:71)
      at com.philip.platformer.main.GamePanel.run(GamePanel.java:51)
      at java.lang.Thread.run(Unknown Source)
      (I have changed the package names)