class
Opal::Game::Pong
- Opal::Game::Pong
- Reference
- Object
Overview
Complete playable Pong physics simulation and renderer
Defined in:
opal/game/pong.crConstructors
Instance Method Summary
- #ai_score : Int32
- #ai_score=(ai_score : Int32)
- #ai_y : Float64
- #ai_y=(ai_y : Float64)
- #ball_vx : Float64
- #ball_vx=(ball_vx : Float64)
- #ball_vy : Float64
- #ball_vy=(ball_vy : Float64)
- #ball_x : Float64
- #ball_x=(ball_x : Float64)
- #ball_y : Float64
- #ball_y=(ball_y : Float64)
- #court_height : Int32
- #court_height=(court_height : Int32)
- #court_width : Int32
- #court_width=(court_width : Int32)
-
#draw(buffer : UI::Buffer, offset_x : Int32 = 0, offset_y : Int32 = 0, alpha : Float64 = 1.0) : Nil
Renders the Pong court, paddles, particles, ball, and score onto a buffer
- #move_player(delta : Float64)
- #paddle_height : Int32
- #paddle_height=(paddle_height : Int32)
- #particles : Array(Particle)
- #particles=(particles : Array(Particle))
- #player_score : Int32
- #player_score=(player_score : Int32)
- #player_y : Float64
- #player_y=(player_y : Float64)
- #reset_ball(direction : Float64 = 1.0)
- #update(dt : Float64)
Constructor Detail
Instance Method Detail
def draw(buffer : UI::Buffer, offset_x : Int32 = 0, offset_y : Int32 = 0, alpha : Float64 = 1.0) : Nil
#
Renders the Pong court, paddles, particles, ball, and score onto a buffer