Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Vector(cx: Int, cy: Int) {
- def x = cx
- def y = cy
- }
- class Sprite(filename: String) {
- }
- trait TPosition {
- def position: Vector
- }
- trait TSprite {
- def sprite: Sprite
- def render() {
- println("sprite.render")
- }
- }
- abstract class Entity {
- def name: String
- def update
- }
- class Player(cname: String) extends Entity with TPosition with TSprite {
- val name = cname
- val position = new Vector(0, 0)
- val sprite = new Sprite("assets/sprites/player.json")
- def update() {
- println("player.update")
- }
- }
- object Main {
- def main(args: Array[String]) {
- var p = new Player("Player")
- p.update
- p.render
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement