Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Bullet
- Field image:Image
- Field x:Float
- Field y:Float
- Field vx:Float
- Field vy:Float
- Field angle:Float
- Method New(x:Float,y:Float,image:Image)
- this.image = image
- End
- Method CalculateVector:Void(angle:Float, speed:float)
- self.angle = angle
- vx = Cos(angle) * speed
- vy = Sin(angle) * speed
- End
- Method Update:Void(delta:Float)
- x += (vx * delta)
- y += (vy * delta)
- End
- Method Render:Void()
- PushMatrix()
- Rotate(angle)
- DrawImage(image,x,y)
- PopMatrix()
- End
- End
- Class Player
- Field bullets:= New List<Bellet>
- Field x:float
- Field y:float
- Field bulletImage:Image
- Method FireInDirection:Void(angle:Float)
- Local bullet := new Bullet(x,y,bulletImage)
- bullets.AddLast(bullet)
- End
- Method Update:Void(delta:Float)
- For Local bullet := eachin bullets
- bullet.Update(delta)
- Next
- End
- Method Render:void()
- For Local bullet := eachin bullets
- bullet.Render()
- Next
- End
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement