...
This commit is contained in:
parent
8d8ce41e71
commit
92db008ccf
3 changed files with 5 additions and 7 deletions
|
@ -20,8 +20,9 @@ func NewPlayer() *Player {
|
|||
Sprite: &gx.Sprite{
|
||||
Object: &gx.Object{
|
||||
T: gx.Transform {
|
||||
P: gx.Vector{1, 1},
|
||||
P: gx.Vector{100, 150},
|
||||
S: gx.Vector{5, 5},
|
||||
RA: gx.Vector{200, 200},
|
||||
},
|
||||
},
|
||||
Image: playerImg,
|
||||
|
|
|
@ -70,19 +70,15 @@ func (e *Engine) AddBehaver(b Behaver) {
|
|||
e.behavers = append(e.behavers, b)
|
||||
}
|
||||
|
||||
func (e *engine) setNewDT() {
|
||||
e.dt = time.Since(e.lastTime).Seconds()
|
||||
e.lastTime = time.Now()
|
||||
}
|
||||
|
||||
func (e *engine) Update() error {
|
||||
eng := (*Engine)(e)
|
||||
|
||||
e.setNewDT()
|
||||
e.dt = time.Since(e.lastTime).Seconds()
|
||||
for _, v := range eng.behavers {
|
||||
v.Update(eng)
|
||||
//fmt.Println(v)
|
||||
}
|
||||
e.lastTime = time.Now()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ func (t Transform)Matrix() Matrix {
|
|||
g := &Matrix{}
|
||||
|
||||
g.Scale(t.S.X, t.S.Y)
|
||||
g.Translate(-t.RA.X, -t.RA.Y)
|
||||
g.Rotate(t.R)
|
||||
g.Translate(t.P.X, t.P.Y)
|
||||
|
||||
|
|
Loading…
Reference in a new issue