Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "github.com/mortdeus/gocos2d"
- )
- var (
- director = new(gocos2d.Director)
- lvl1 = new(Level)
- groundhog = new(Groundhog)
- )
- func main() {
- Init()
- defer Cleanup()
- for director.Running {
- Update()
- Draw()
- }
- }
- func Init() {
- director.Init()
- lvl1.Init("lvl1")
- groundhog.Init("Groundhog")
- lvl1.AddChild(groundhog)
- director.Push(lvl1)
- }
- func Update() {
- director.Update()
- }
- func Draw() {
- director.Draw()
- }
- func Cleanup() {
- director.Cleanup()
- lvl1.RemoveChild("Groundhog")
- }
- type Level struct {
- *gocos2d.Scene
- }
- func (this *Level) Init(id gocos2d.Tag) {
- this.Scene = new(gocos2d.Scene)
- this.Scene.Init(id)
- }
- func (this *Level) Update() {
- }
- func (this *Level) Draw() {
- }
- func (this *Level) OnEnter() {
- }
- func (this *Level) OnExit() {
- }
- type Groundhog struct {
- *gocos2d.Sprite
- }
- func (this *Groundhog) Init(id gocos2d.Tag) {
- this.Sprite = new(gocos2d.Sprite)
- this.Sprite.Init(id)
- }
- func (this *Groundhog) Update() {
- }
- func (this *Groundhog) Draw() {
- }
- func (this *Groundhog) OnEnter() {
- }
- func (this *Groundhog) OnExit() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement