Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
Project
Project
Details
Activity
Releases
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
崔立强
db-game-template
Commits
a317d322
Commit
a317d322
authored
Dec 26, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
201616ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
index.html
egret/index.html
+3
-3
createItems.ts
egret/src/startScene/createItems.ts
+17
-9
No files found.
egret/index.html
View file @
a317d322
...
...
@@ -44,9 +44,9 @@
<script
src=
"libs/downloadApp.js"
></script>
<!-- <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.4.0/math.js'></script> -->
<script>
localStorage
.
clear
();
localStorage
.
setItem
(
'currentLv'
,
'Gift2'
);
localStorage
.
setItem
(
'data'
,
JSON
.
stringify
({
"IceCream"
:
3
,
"Donut"
:
3
,
"Egg"
:
3
,
"Candy2"
:
3
,
"Gift2"
:
2
}))
//
localStorage.clear();
//
localStorage.setItem('currentLv','Gift2');
//
localStorage.setItem('data',JSON.stringify({"IceCream":3,"Donut":3,"Egg":3,"Candy2":3,"Gift2":2}))
window
[
'development'
]
=
true
;
var
gameId
=
1
;
var
CFG
=
{
...
...
egret/src/startScene/createItems.ts
View file @
a317d322
...
...
@@ -11,9 +11,6 @@ const restitution = 0.7;
// const types = [LabelType.Candy2,LabelType.Donut,LabelType.Egg];
const
types
=
[
LabelType
.
Boom
,
LabelType
.
IceCream
,
LabelType
.
Donut
,
LabelType
.
Candy2
,
LabelType
.
Gift2
,
LabelType
.
Egg
];
let
frameInterval
=
10
;
let
tags
=
0
;
if
(
localStorage
.
getItem
(
'guilde1'
)
==
'1'
)
tags
=
1
;
if
(
localStorage
.
getItem
(
'guilde2'
)
==
'1'
)
tags
=
2
;
let
pastFrame
=
0
;
let
_this
;
...
...
@@ -22,12 +19,21 @@ const ontick = () => {
pastFrame
++
;
return
};
let
tags
=
0
;
let
dir
;
if
(
localStorage
.
getItem
(
'guilde1'
)
==
'1'
)
tags
=
1
;
if
(
localStorage
.
getItem
(
'guilde2'
)
==
'1'
)
tags
=
2
;
if
(
pastFrame
>=
frameInterval
)
pastFrame
=
0
;
let
i
=
Math
.
floor
(
Math
.
random
()
*
types
.
length
);
if
(
tags
==
0
)
{
i
=
1
;
tags
=
1
;
frameInterval
=
180
;
}
else
if
(
tags
==
1
)
{
i
=
0
;
tags
=
2
;
}
if
(
tags
==
0
)
{
i
=
1
;
dir
=
'left'
;
frameInterval
=
180
;
}
else
if
(
tags
==
1
)
{
i
=
0
;
dir
=
'right'
}
else
if
(
tags
==
2
)
{
frameInterval
=
60
;
dir
=
null
;
}
// i=4;
const
type
=
types
[
i
];
...
...
@@ -36,7 +42,9 @@ const ontick = () => {
const
forceScale
=
15
;
const
leftStart
=
{
x
:
startX
,
y
:
startY
,
forceX
:
0.01
*
forceScale
};
const
rightStart
=
{
x
:
750
-
startX
,
y
:
startY
,
forceX
:
-
0.01
*
forceScale
};
const
start
=
Math
.
random
()
>
0.5
?
leftStart
:
rightStart
;
const
isleft
=
Math
.
random
()
>
0.5
;
console
.
log
(
'isleft'
,
isleft
)
const
start
=
isleft
?
leftStart
:
rightStart
;
const
scale
=
2
;
const
baseItem
=
createItem
(
scale
,
type
);
body
=
_this
.
_egretRender
.
rectangle
(
start
.
x
,
start
.
y
,
49
*
scale
,
18
*
scale
,
baseItem
,
...
...
@@ -55,9 +63,9 @@ const ontick = () => {
const
leftStart
=
{
x
:
startX
,
y
:
startY
,
forceX
:
0.01
*
forceScale
};
const
rightStart
=
{
x
:
750
-
startX
,
y
:
startY
,
forceX
:
-
0.01
*
forceScale
};
let
start
=
Math
.
random
()
>
0.5
?
leftStart
:
rightStart
;
if
(
tags
==
1
)
{
if
(
dir
==
'left'
)
{
start
=
leftStart
;
}
else
if
(
tags
==
2
)
{
}
else
if
(
dir
==
'right'
)
{
start
=
rightStart
;
}
const
size
=
49
*
1.15
;
...
...
@@ -80,7 +88,7 @@ const ontick = () => {
export
default
(
$this
:
StartScene
)
=>
{
_this
=
$this
;
if
(
isAllLevelPass
())
return
;
if
(
isAllLevelPass
())
return
;
egret
.
startTick
(
ontick
,
this
)
}
...
...
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