weixin_39789979
weixin_39789979
2020-12-01 21:41

Parallax and Viewpoint problem!

I'm trying to use a simple parallax in a viewport example21_sidescroller_with_edit.rb similar to, but when I walk too much parallax repeated stops, these two traits are incompatible? and tested in various ways and nothing.

At first he repetipe several times but when I move a lot of stops and the only thing left is the black background of the viewport. Any help?

Sorry for the bad English :)

Basically, this is what I'm doing:

class Nivel1 < GameState traits :viewport

def initialize(options = {}) super self.input = {:e => :edit} self.viewport.game_area = [0, 0, 3000, HEIGHT]


 = Chingu::Parallax.create(:x => 0, :y => 0, :rotation_center => :top_left)
.add_layer(
  :image => "space.png",
  :repeat_x => true,
  :repeat_y => false,
  :damping => 5
)

load_game_objects
 = Player.create

end

def edit push_game_state(GameStates::Edit.new( :grid => [32,32], #tamaño de las rejillas en el modo editor. :classes => [ Player, Rocks, Water ])) end

def update super self.viewport.center_around() .camera_x, .camera_y = self.viewport.x, self.viewport.y end end

该提问来源于开源项目:ippa/chingu

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

6条回答