Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crazyflirt
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shawn Wang
crazyflirt
Commits
7196a511
Commit
7196a511
authored
May 05, 2018
by
Shawn Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add me
parent
d3f5dd4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
Guy.ts
fe/src/Guy.ts
+25
-0
GameScene.ts
fe/src/scenes/GameScene.ts
+4
-7
No files found.
fe/src/Guy.ts
0 → 100644
View file @
7196a511
class
Guy
extends
egret
.
Sprite
{
public
constructor
()
{
super
()
this
.
init
()
}
private
avatar
=
new
egret
.
Bitmap
()
private
imageLoader
=
new
egret
.
ImageLoader
()
private
init
()
{
this
.
avatar
.
width
=
72
this
.
avatar
.
height
=
72
this
.
imageLoader
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
this
.
loadCompleteHandler
,
this
)
this
.
imageLoader
.
load
(
"http://www.insajderi.com/wp-content/uploads/2018/01/asdja.jpg"
)
this
.
addChild
(
this
.
avatar
)
}
private
loadCompleteHandler
()
{
let
texture
=
new
egret
.
Texture
()
texture
.
_setBitmapData
(
this
.
imageLoader
.
data
)
this
.
avatar
.
texture
=
texture
}
}
\ No newline at end of file
fe/src/scenes/GameScene.ts
View file @
7196a511
...
...
@@ -7,7 +7,7 @@ class GameScene extends egret.Sprite {
this
.
init
()
}
private
pointtt
=
new
egret
.
Shape
()
private
me
=
new
Guy
()
// 初始化(给开始按钮绑定点击事件)
private
init
()
{
...
...
@@ -16,16 +16,13 @@ class GameScene extends egret.Sprite {
this
.
addChild
(
this
.
controller
)
this
.
controller
.
addEventListener
(
"position_change"
,
this
.
onPositionChange
,
this
)
this
.
pointtt
.
graphics
.
beginFill
(
0xFF0000
,
1
)
this
.
pointtt
.
graphics
.
drawCircle
(
667
,
375
,
15
)
this
.
pointtt
.
graphics
.
endFill
()
this
.
addChild
(
this
.
pointtt
)
this
.
addChild
(
this
.
me
)
}
private
step
=
72
private
onPositionChange
(
delta
){
this
.
pointtt
.
x
+=
this
.
step
*
delta
.
data
.
x
this
.
pointtt
.
y
+=
this
.
step
*
delta
.
data
.
y
this
.
me
.
x
+=
this
.
step
*
delta
.
data
.
x
this
.
me
.
y
+=
this
.
step
*
delta
.
data
.
y
}
public
release
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment