Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scilla-kickball
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
wildfirecode13
scilla-kickball
Commits
0dca725c
Commit
0dca725c
authored
Apr 22, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1e3632af
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
26 deletions
+49
-26
BallItem.ts
assets/scripts/scenes/BallItem.ts
+15
-5
ScenePlay.ts
assets/scripts/scenes/ScenePlay.ts
+2
-2
gameconst.ts.meta
assets/scripts/scenes/gameconst.ts.meta
+1
-0
bundle.js
debug/bundle.js
+24
-12
bundle.js.map
debug/bundle.js.map
+1
-1
ScillaComponent.ts
node_modules/scilla-components/src/base/ScillaComponent.ts
+5
-5
registerAllComponents.ts
node_modules/scilla-components/src/registerAllComponents.ts
+1
-1
No files found.
assets/scripts/scenes/BallItem.ts
View file @
0dca725c
...
...
@@ -3,14 +3,24 @@ import { Transform } from 'scilla-components/src';
import
{
gravityY
}
from
'./gameconst'
;
export
default
class
BallItem
extends
ScillaComponent
{
private
_speedY
=
0
;
private
_bounceY
=
0
;
private
_velocityY
=
0
;
onUpdate
()
{
const
{
entity
}
=
this
;
this
.
_
speed
Y
+=
gravityY
;
entity
.
getComponent
(
Transform
).
position
.
y
+=
this
.
_
speed
Y
;
this
.
_
velocity
Y
+=
gravityY
;
entity
.
getComponent
(
Transform
).
position
.
y
+=
this
.
_
velocity
Y
;
}
bounceY
(){
this
.
_speedY
*=
-
1
;
revertY
()
{
this
.
_velocityY
*=
-
1
*
this
.
_bounceY
;
console
.
log
(
this
.
_velocityY
)
}
set
bounceY
(
val
:
number
)
{
this
.
_bounceY
=
val
;
}
get
bounceY
()
{
return
this
.
_bounceY
;
}
}
\ No newline at end of file
assets/scripts/scenes/ScenePlay.ts
View file @
0dca725c
...
...
@@ -23,6 +23,7 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
this
.
entity
.
addChild
(
ball
);
this
.
ballList
.
push
(
ball
);
console
.
log
(
ball
.
getComponent
(
Transform
).
position
.
y
);
(
ball
.
getComponent
(
BallItem
)
as
BallItem
).
bounceY
=
0.99
;
}
onAwake
()
{
...
...
@@ -33,10 +34,9 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
onUpdate
()
{
for
(
const
ball
of
this
.
ballList
)
{
const
{
position
}
=
ball
.
getComponent
(
Transform
);
console
.
log
(
position
.
y
)
if
(
position
.
y
>
GROUND_Y
)
{
position
.
y
=
GROUND_Y
;
(
ball
.
getComponent
(
BallItem
)
as
BallItem
).
bounce
Y
();
(
ball
.
getComponent
(
BallItem
)
as
BallItem
).
revert
Y
();
}
}
}
...
...
assets/scripts/scenes/gameconst.ts.meta
0 → 100644
View file @
0dca725c
{"ver":"1.0.1","uuid":"157cb7f7-3398-47d4-ade4-59d4de30f839","subMetas":{},"type":"script"}
debug/bundle.js
View file @
0dca725c
...
...
@@ -349,33 +349,33 @@
return
false
;
};
Component
.
prototype
.
broadcast
=
function
(
method
,
level
)
{
var
_a
;
if
(
level
===
void
0
)
{
level
=
-
1
;
}
var
params
=
[];
for
(
var
_i
=
2
;
_i
<
arguments
.
length
;
_i
++
)
{
params
[
_i
-
2
]
=
arguments
[
_i
];
}
var
_a
;
(
_a
=
this
.
entity
).
broadcast
.
apply
(
_a
,
__spread
([
method
,
level
],
params
));
};
Component
.
prototype
.
bubbling
=
function
(
method
)
{
var
_a
;
var
params
=
[];
for
(
var
_i
=
1
;
_i
<
arguments
.
length
;
_i
++
)
{
params
[
_i
-
1
]
=
arguments
[
_i
];
}
var
_a
;
(
_a
=
this
.
entity
).
bubbling
.
apply
(
_a
,
__spread
([
method
],
params
));
};
return
Component
;
}(
HashObject
));
function
traverse
(
target
,
hitChild
,
level
,
includeSelf
,
fullCallback
)
{
var
e_1
,
_a
;
if
(
level
===
void
0
)
{
level
=
-
1
;
}
if
(
includeSelf
===
void
0
)
{
includeSelf
=
false
;
}
var
params
=
[];
for
(
var
_i
=
5
;
_i
<
arguments
.
length
;
_i
++
)
{
params
[
_i
-
5
]
=
arguments
[
_i
];
}
var
e_1
,
_a
;
if
(
includeSelf
)
{
hitChild
.
apply
(
void
0
,
__spread
([
target
],
params
));
}
...
...
@@ -2093,11 +2093,11 @@
return
!!
this
.
findListener
(
callback
);
};
ScillaEvent
.
prototype
.
invoke
=
function
()
{
var
e_1
,
_a
;
var
paramsNew
=
[];
for
(
var
_i
=
0
;
_i
<
arguments
.
length
;
_i
++
)
{
paramsNew
[
_i
]
=
arguments
[
_i
];
}
var
e_1
,
_a
;
var
_subscribers
=
this
.
_subscribers
;
_subscribers
.
sort
(
function
(
a
,
b
)
{
return
a
.
priority
-
b
.
priority
;
...
...
@@ -2516,8 +2516,8 @@
return
begin
+
distance
*
t
*
sign
;
}
function
lerpObj
(
begin
,
end
,
t
,
fields
,
allowOutOfBounds
)
{
if
(
allowOutOfBounds
===
void
0
)
{
allowOutOfBounds
=
false
;
}
var
e_1
,
_a
;
if
(
allowOutOfBounds
===
void
0
)
{
allowOutOfBounds
=
false
;
}
var
type
=
typeof
begin
;
if
(
type
!==
typeof
end
)
{
console
.
error
(
'begin and end need same type'
);
...
...
@@ -7089,17 +7089,29 @@
__extends
(
BallItem
,
_super
);
function
BallItem
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
_speedY
=
0
;
_this
.
_bounceY
=
0
;
_this
.
_velocityY
=
0
;
return
_this
;
}
BallItem
.
prototype
.
onUpdate
=
function
()
{
var
entity
=
this
.
entity
;
this
.
_
speed
Y
+=
gravityY
;
entity
.
getComponent
(
Transform
).
position
.
y
+=
this
.
_
speed
Y
;
this
.
_
velocity
Y
+=
gravityY
;
entity
.
getComponent
(
Transform
).
position
.
y
+=
this
.
_
velocity
Y
;
};
BallItem
.
prototype
.
bounceY
=
function
()
{
this
.
_speedY
*=
-
1
;
BallItem
.
prototype
.
revertY
=
function
()
{
this
.
_velocityY
*=
-
1
*
this
.
_bounceY
;
console
.
log
(
this
.
_velocityY
);
};
Object
.
defineProperty
(
BallItem
.
prototype
,
"bounceY"
,
{
get
:
function
()
{
return
this
.
_bounceY
;
},
set
:
function
(
val
)
{
this
.
_bounceY
=
val
;
},
enumerable
:
true
,
configurable
:
true
});
return
BallItem
;
}(
ScillaComponent
));
...
...
@@ -7114,6 +7126,7 @@
this
.
entity
.
addChild
(
ball
);
this
.
ballList
.
push
(
ball
);
console
.
log
(
ball
.
getComponent
(
Transform
).
position
.
y
);
ball
.
getComponent
(
BallItem
).
bounceY
=
0.99
;
};
ScenePlay
.
prototype
.
onAwake
=
function
()
{
_super
.
prototype
.
onAwake
.
call
(
this
);
...
...
@@ -7125,10 +7138,9 @@
for
(
var
_b
=
__values
(
this
.
ballList
),
_c
=
_b
.
next
();
!
_c
.
done
;
_c
=
_b
.
next
())
{
var
ball
=
_c
.
value
;
var
position
=
ball
.
getComponent
(
Transform
).
position
;
console
.
log
(
position
.
y
);
if
(
position
.
y
>
GROUND_Y
)
{
position
.
y
=
GROUND_Y
;
ball
.
getComponent
(
BallItem
).
bounce
Y
();
ball
.
getComponent
(
BallItem
).
revert
Y
();
}
}
}
...
...
debug/bundle.js.map
View file @
0dca725c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
node_modules/scilla-components/src/base/ScillaComponent.ts
View file @
0dca725c
...
...
@@ -2,11 +2,11 @@
* Created by rockyl on 2019-04-17.
*/
import
{
Component
}
from
'scilla'
import
{
Component
}
from
'scilla'
import
Transform
from
"./Transform"
;
export
default
class
ScillaComponent
extends
Component
{
get
transform
():
Transform
{
export
default
class
ScillaComponent
extends
Component
{
get
transform
():
Transform
{
return
this
.
entity
.
getComponentByName
(
'components/base/Transform'
);
}
}
\ No newline at end of file
}
node_modules/scilla-components/src/registerAllComponents.ts
View file @
0dca725c
import
{
registerDef
}
from
"scilla"
import
ScillaComponent
from
'./base/ScillaComponent'
;
import
BounceZoom
from
'./animation/BounceZoom'
;
import
Fade
from
'./animation/Fade'
;
import
Rotation
from
'./animation/Rotation'
;
...
...
@@ -10,6 +9,7 @@ import TouchZoom from './animation/TouchZoom';
import
Wave
from
'./animation/Wave'
;
import
ZoomLoop
from
'./animation/ZoomLoop'
;
import
InteractComponent
from
'./base/InteractComponent'
;
import
ScillaComponent
from
'./base/ScillaComponent'
;
import
TouchInterrupt
from
'./base/TouchInterrupt'
;
import
Transform
from
'./base/Transform'
;
import
AjaxElementComponent
from
'./net/api/hdtool/base/AjaxElementComponent'
;
...
...
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