class Bullet
GLUT.load_lib()
Constants
- COOLDOWN_DELAY
- DAMAGE
- MAX_SPEED
Friendly projects are + speeds
Public Class Methods
new(scale, screen_width, screen_height, object, options = {})
click to toggle source
Calls superclass method
DumbProjectile::new
# File line-em-up/models/bullet.rb, line 40 def initialize(scale, screen_width, screen_height, object, options = {}) super(scale, screen_width, screen_height, object, options) end
Public Instance Methods
draw()
click to toggle source
include Gl include Glu include Glut
# File line-em-up/models/bullet.rb, line 35 def draw # draw nothing @image.draw(@x - get_width / 2, @y - get_height / 2, get_draw_ordering, @scale, @scale) end
draw_gl()
click to toggle source
end
# File line-em-up/models/bullet.rb, line 89 def draw_gl # height = 20 * @scale # width = 30 * @scale # new_pos_x, new_pos_y, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x, @y, @screen_width, @screen_height) # new_width1, new_height1, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x + width / 2, @y, @screen_width, @screen_height) # new_width2, new_height2, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x, @y + height, @screen_width, @screen_height) # new_width3, new_height3, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x - width / 2, @y, @screen_width, @screen_height) # # height = 55 * increment_y * @scale # # width = 55 * increment_x * @scale # z = ZOrder::Projectile # # glLineWidth(5 * @scale) # # scale = 1.0 * @scale # glBegin(GL_TRIANGLES) # glColor4f(1, 0.5, 0.5, get_draw_ordering) # glVertex3f(new_width1, new_height1, 0.0) # glVertex3f(new_width2, new_height2, 0.0) # glVertex3f(new_width3, new_height3, 0.0) # glEnd # # glBegin(GL_TRIANGLES) # # glColor4f(1, 1, 1, 1) # # glVertex3f(new_width1, new_height3 + 0.1, 0.0) # # glVertex3f(new_width3, new_height2 + 0.1, 0.0) # # glVertex3f(new_width2, new_height1 + 0.1, 0.0) # # glEnd # new_width1, new_height1, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x - width / 2, @y + height, @screen_width , @screen_height) # new_width2, new_height2, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x , @y , @screen_width, @screen_height) # new_width3, new_height3, increment_x, increment_y = Bullet.convert_x_and_y_to_opengl_coords(@x + width / 2, @y + height, @screen_width , @screen_height) # glBegin(GL_TRIANGLES) # glColor4f(0.5, 1, 0.5, get_draw_ordering) # glVertex3f(new_width1, new_height1, 0.0) # glVertex3f(new_width2, new_height2, 0.0) # glVertex3f(new_width3, new_height3, 0.0) # glEnd # # ======= # # glLineWidth(20 * @scale) # # glBegin(GL_LINES) # # # 22.4% red, 100% green and 7.8% blue # # glColor3f(1, 1.0, 1.0) # # glVertex3d(new_pos_x, new_pos_y, z) # # glVertex3d(new_pos_x, new_pos_y + height, z) # # glEnd # # >>>>>>> 8012b34281af3e19bb5f897bcab2161c1a00e7b0 end
get_image()
click to toggle source
# File line-em-up/models/bullet.rb, line 25 def get_image # Gosu::Image.new("#{MEDIA_DIRECTORY}/laserbolt.png") Gosu::Image.new("#{MEDIA_DIRECTORY}/bullet-mini.png") end