Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HaSi-Gamejam 2021
Pando
Commits
acd9ee4c
Commit
acd9ee4c
authored
Apr 10, 2021
by
dcz
Browse files
brett: Bessere Regeln for was unerlaubt ist
parent
7cee15a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/map.cs
View file @
acd9ee4c
...
...
@@ -12,7 +12,7 @@ class Powerup {
}
class
Brushable
:
BitMap
{
public
void
stempeln
(
BitMap
brush
,
Vector2
platz
)
{
public
void
stempeln
(
BitMap
brush
,
Vector2
platz
,
BitMap
ohne
=
null
)
{
Vector2
limit
=
brush
.
GetSize
();
for
(
int
x
=
(
int
)
platz
.
x
;
x
<
Math
.
Min
(
platz
.
x
+
limit
.
x
,
GetSize
().
x
);
x
++)
{
for
(
int
y
=
(
int
)
platz
.
y
;
y
<
Math
.
Min
(
platz
.
y
+
limit
.
y
,
GetSize
().
y
);
y
++)
{
...
...
@@ -20,15 +20,18 @@ class Brushable : BitMap {
Vector2
pxpos
=
new
Vector2
(
x
,
y
);
bool
brush_bit
=
brush
.
GetBit
(
pxpos
-
platz
);
bool
bild_bit
=
GetBit
(
pxpos
);
SetBit
(
pxpos
,
brush_bit
|
bild_bit
);
if
(
ohne
==
null
||
!
ohne
.
GetBit
(
pxpos
))
{
SetBit
(
pxpos
,
brush_bit
|
bild_bit
);
}
}
}
}
public
void
stempelnMitte
(
BitMap
brush
,
Vector2
platz
)
{
public
void
stempelnMitte
(
BitMap
brush
,
Vector2
platz
,
BitMap
ohne
=
null
)
{
Vector2
limit
=
brush
.
GetSize
();
Vector2
mitte
=
limit
/
2
;
platz
=
platz
+
mitte
;
stempeln
(
brush
,
platz
);
stempeln
(
brush
,
platz
,
ohne
);
}
}
...
...
@@ -91,6 +94,10 @@ class Bitwise : Brushable {
}
return
b
;
}
public
Bitwise
and_not
(
Bitwise
other
)
{
return
and
(
other
.
neg
());
}
}
public
class
map
:
Node2D
...
...
@@ -144,11 +151,12 @@ public class map : Node2D
// platz = offset, nicht Mitte
public
void
stellDunger
(
int
spielerIdx
,
Vector2
platz
)
{
spiel
er
[
spielerIdx
].
stempelnMitte
(
dungerBrush
(),
platz
);
dung
er
[
spielerIdx
].
stempelnMitte
(
dungerBrush
(),
platz
);
}
public
void
stellBarriere
(
Vector2
platz
)
{
barrieren
.
stempelnMitte
(
barriereBrush
(),
platz
);
Bitwise
unerlaubt
=
spieler
[
0
].
or
(
spieler
[
1
]);
barrieren
.
stempelnMitte
(
barriereBrush
(),
platz
,
unerlaubt
);
}
public
void
verbreitenSpieler
(
int
spielerIdx
)
{
...
...
@@ -156,7 +164,8 @@ public class map : Node2D
int
wachstumbudget
=
13
;
Vector2
n
=
new
Vector2
(
0
,
0
);
Vector2
m
=
spieler
[
spielerIdx
].
GetSize
();
Bitwise
erlaubt
=
dunger
[
spielerIdx
].
or
(
spieler
[
spielerIdx
]);
Bitwise
unerlaubt
=
spieler
[-
spielerIdx
+
1
].
or
(
barrieren
);
Bitwise
erlaubt
=
dunger
[
spielerIdx
].
and_not
(
unerlaubt
);
Bitwise
neu_stand
=
(
Bitwise
)
spieler
[
spielerIdx
].
Duplicate
(
true
);
while
(
wachstumbudget
>
0
)
{
neu_stand
.
GrowMask
(
wachsengeschwindigkeit
,
new
Rect2
(
n
,
m
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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