Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DataManager.init
- module Math
- def self.radian(degree)
- return (degree.to_f/180) * Math::PI
- end
- def self.degree(radian)
- return (radian.to_f/Math::PI) * 180
- end
- class << self
- alias theo_sin sin
- alias theo_cos cos
- end
- def self.sin(x)
- return theo_sin(x) if x % radian(180) != 0
- return 0.0
- end
- def self.cos(x)
- return theo_cos(x) if x % radian(0) != 0
- return 0.0
- end
- end
- class Window_BulletTest < Window_Base
- @@count = 0
- def initialize(x,y,width,height)
- super(x,y,width,height)
- @@count += 1
- end
- def update_movement
- self.y -= 3 unless disposed?
- end
- alias bullet_dispose dispose
- def dispose
- bullet_dispose
- @@count -= 1
- end
- def self.count
- @@count
- end
- end
- def updates
- Graphics.update
- Input.update
- $bullet.each do |bullet|
- next if bullet.nil?
- bullet.update_movement
- if bullet.y <= 0
- $bullet.delete(bullet)
- bullet.dispose
- end
- end
- $window.x = $pusat.x + (50*Math.cos(Math.radian($test)))
- $window.y = $pusat.y + (50*Math.sin(Math.radian($test)))
- if Input.press?(:UP)
- $pusat.y -= 3
- elsif Input.press?(:DOWN)
- $pusat.y += 3
- elsif Input.press?(:LEFT)
- $pusat.x -= 3
- elsif Input.press?(:RIGHT)
- $pusat.x += 3
- elsif Input.trigger?(:C)
- puts "shot!"
- $bullet.push(Window_BulletTest.new($pusat.x,$pusat.y,24,24))
- end
- $test += 10
- end
- $bullet = []
- $test = 0
- $pusat = Window_Base.new(100-12,200-12,24,24)
- $window = Window_Base.new(100-12,200-12,24,24)
- $window.viewport = Viewport.new
- updates while true
Advertisement
Add Comment
Please, Sign In to add comment