Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DecisionDay270120
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
a.guest
DecisionDay270120
Commits
2d44930c
Commit
2d44930c
authored
Jan 21, 2020
by
a.guest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update processing.pde
parent
4890f982
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
processing.pde
processing.pde
+23
-6
No files found.
processing.pde
View file @
2d44930c
...
@@ -206,7 +206,9 @@ class ExplosionPart
...
@@ -206,7 +206,9 @@ class ExplosionPart
float
y_position
;
float
y_position
;
float
x_velocity
;
float
x_velocity
;
float
y_velocity
;
float
y_velocity
;
int
colour
;
int
red_colour
;
int
green_colour
;
int
blue_colour
;
int
part_size
;
int
part_size
;
ExplosionPart
(
float
x
,
float
y
)
ExplosionPart
(
float
x
,
float
y
)
...
@@ -219,7 +221,9 @@ class ExplosionPart
...
@@ -219,7 +221,9 @@ class ExplosionPart
y_velocity
=
random
(
20
)
-
10
;
y_velocity
=
random
(
20
)
-
10
;
// give the part a random shade of red as a starting colour
// give the part a random shade of red as a starting colour
// each update the part will get slightly darker
// each update the part will get slightly darker
colour
=
int
(
random
(
200
))
+
50
;
red_colour
=
int
(
random
(
200
))
+
50
;
green_colour
=
0
;
blue_colour
=
0
;
// give the part a random size
// give the part a random size
// each update the part will get slightly smaller
// each update the part will get slightly smaller
part_size
=
15
+
int
(
random
(
10
));
part_size
=
15
+
int
(
random
(
10
));
...
@@ -228,11 +232,24 @@ class ExplosionPart
...
@@ -228,11 +232,24 @@ class ExplosionPart
void
update
()
void
update
()
{
{
// make the part's colour a little darker
// make the part's colour a little darker
colour
=
colour
-
int
(
random
(
20
));
red_colour
=
red_
colour
-
int
(
random
(
20
));
if
(
colour
<
1
0
)
if
(
red_colour
<
0
)
{
{
colour
=
1
0
;
red_colour
=
0
;
}
}
green_colour
=
green_colour
-
int
(
random
(
20
));
if
(
green_colour
<
0
)
{
green_colour
=
0
;
}
blue_colour
=
blue_colour
-
int
(
random
(
20
));
if
(
blue_colour
<
0
)
{
blue_colour
=
0
;
}
// make the part a little smaller
// make the part a little smaller
part_size
--
;
part_size
--
;
if
(
part_size
<
1
)
if
(
part_size
<
1
)
...
@@ -248,7 +265,7 @@ class ExplosionPart
...
@@ -248,7 +265,7 @@ class ExplosionPart
void
render
()
void
render
()
{
{
fill
(
colour
,
0
,
0
);
fill
(
red_colour
,
green_colour
,
blue_colour
);
ellipse
(
x_position
,
y_position
,
part_size
,
part_size
);
ellipse
(
x_position
,
y_position
,
part_size
,
part_size
);
}
}
...
...
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