Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Weapon
- def initialize
- @image = Rubygame::Image.load("rocket.png")
- @rect = []
- @status = []
- end
- def generate x , y , status
- @rect << Rect.new(x,y,*@image.size)
- @status << status
- end
- def movement
- @rect.zip(@status).each do |pos,move|
- if move == true
- pos.centery -= 3
- if pos.centery <= 0
- pos.pop()
- move.pop()
- end
- else
- pos.centery += 3
- if pos.centery >= 600
- pos.pop()
- move.pop()
- end
- end
- end
- end
- def draw screen
- @rect.each do |rect|
- @image.blit(screen,[rect.centerx,rect.centery])
- end
- end
- end
Add Comment
Please, Sign In to add comment