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
354e8916
Commit
354e8916
authored
May 05, 2018
by
Shawn Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control 666
parent
1caae731
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
Controller.ts
fe/src/Controller.ts
+4
-0
Guy.ts
fe/src/Guy.ts
+4
-4
GameScene.ts
fe/src/scenes/GameScene.ts
+9
-1
No files found.
fe/src/Controller.ts
View file @
354e8916
...
@@ -33,24 +33,28 @@ class Controller extends egret.Sprite {
...
@@ -33,24 +33,28 @@ class Controller extends egret.Sprite {
this
.
up
.
graphics
.
drawRect
(
93
,
0
,
80
,
80
)
this
.
up
.
graphics
.
drawRect
(
93
,
0
,
80
,
80
)
this
.
up
.
graphics
.
endFill
()
this
.
up
.
graphics
.
endFill
()
this
.
up
.
touchEnabled
=
true
this
.
up
.
touchEnabled
=
true
this
.
up
.
alpha
=
0
this
.
up
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
up
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
down
.
graphics
.
beginFill
(
0xFF00FF
,
1
)
this
.
down
.
graphics
.
beginFill
(
0xFF00FF
,
1
)
this
.
down
.
graphics
.
drawRect
(
93
,
186
,
80
,
80
)
this
.
down
.
graphics
.
drawRect
(
93
,
186
,
80
,
80
)
this
.
down
.
graphics
.
endFill
()
this
.
down
.
graphics
.
endFill
()
this
.
down
.
touchEnabled
=
true
this
.
down
.
touchEnabled
=
true
this
.
down
.
alpha
=
0
this
.
down
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
down
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
left
.
graphics
.
beginFill
(
0xFF00FF
,
1
)
this
.
left
.
graphics
.
beginFill
(
0xFF00FF
,
1
)
this
.
left
.
graphics
.
drawRect
(
0
,
93
,
80
,
80
)
this
.
left
.
graphics
.
drawRect
(
0
,
93
,
80
,
80
)
this
.
left
.
graphics
.
endFill
()
this
.
left
.
graphics
.
endFill
()
this
.
left
.
touchEnabled
=
true
this
.
left
.
touchEnabled
=
true
this
.
left
.
alpha
=
0
this
.
left
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
left
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
right
.
graphics
.
beginFill
(
0xFF00FF
,
1
)
this
.
right
.
graphics
.
beginFill
(
0xFF00FF
,
1
)
this
.
right
.
graphics
.
drawRect
(
186
,
93
,
80
,
80
)
this
.
right
.
graphics
.
drawRect
(
186
,
93
,
80
,
80
)
this
.
right
.
graphics
.
endFill
()
this
.
right
.
graphics
.
endFill
()
this
.
right
.
touchEnabled
=
true
this
.
right
.
touchEnabled
=
true
this
.
right
.
alpha
=
0
this
.
right
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
this
.
right
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
controlTouchBegin
,
this
)
controlContainer
.
addChild
(
this
.
up
)
controlContainer
.
addChild
(
this
.
up
)
...
...
fe/src/Guy.ts
View file @
354e8916
...
@@ -29,11 +29,11 @@ class Guy extends egret.Sprite {
...
@@ -29,11 +29,11 @@ class Guy extends egret.Sprite {
if
(
this
.
x
<=
0
){
if
(
this
.
x
<=
0
){
this
.
x
=
0
this
.
x
=
0
}
}
if
(
this
.
y
<=
0
){
if
(
this
.
y
<=
15
){
this
.
y
=
0
this
.
y
=
15
}
}
if
(
this
.
y
>=
72
*
9
){
if
(
this
.
y
>=
72
*
9
+
15
){
this
.
y
=
72
*
9
this
.
y
=
72
*
9
+
15
}
}
if
(
this
.
x
>=
72
*
13
){
if
(
this
.
x
>=
72
*
13
){
this
.
x
=
72
*
13
this
.
x
=
72
*
13
...
...
fe/src/scenes/GameScene.ts
View file @
354e8916
...
@@ -12,15 +12,23 @@ class GameScene extends egret.Sprite {
...
@@ -12,15 +12,23 @@ class GameScene extends egret.Sprite {
// 初始化(给开始按钮绑定点击事件)
// 初始化(给开始按钮绑定点击事件)
private
init
()
{
private
init
()
{
// put display object to this scene
// put display object to this scene
let
bg
=
new
egret
.
Shape
()
bg
.
graphics
.
beginFill
(
0x343e5f
,
1
)
bg
.
graphics
.
drawRect
(
0
,
0
,
1334
,
750
)
bg
.
graphics
.
endFill
()
this
.
addChild
(
bg
)
this
.
controller
=
new
Controller
()
this
.
controller
=
new
Controller
()
this
.
addChild
(
this
.
controller
)
this
.
addChild
(
this
.
controller
)
this
.
controller
.
addEventListener
(
"position_change"
,
this
.
onPositionChange
,
this
)
this
.
controller
.
addEventListener
(
"position_change"
,
this
.
onPositionChange
,
this
)
this
.
map
=
new
Map
()
this
.
map
=
new
Map
()
this
.
map
.
y
=
15
this
.
me
.
y
=
15
this
.
addChild
(
this
.
map
)
this
.
addChild
(
this
.
map
)
this
.
addChild
(
this
.
me
)
this
.
addChild
(
this
.
me
)
}
}
private
onPositionChange
(
delta
){
private
onPositionChange
(
delta
){
this
.
me
.
applyDelta
(
delta
.
data
)
this
.
me
.
applyDelta
(
delta
.
data
)
}
}
...
...
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