Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
neon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cristian Weiland
neon
Commits
31afeb47
Commit
31afeb47
authored
Jul 4, 2016
by
Cristian Weiland
Browse files
Options
Downloads
Patches
Plain Diff
Trap seems to work!
Signed-off-by:
Cristian Weiland
<
cw14@inf.ufpr.br
>
parent
31da0c06
No related branches found
No related tags found
1 merge request
!26
Magia trap
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
Comandos/cmd.txt
+2
-2
2 additions, 2 deletions
Comandos/cmd.txt
colisao.h
+4
-3
4 additions, 3 deletions
colisao.h
imprime.c
+13
-3
13 additions, 3 deletions
imprime.c
keys.c
+8
-0
8 additions, 0 deletions
keys.c
magia.c
+20
-11
20 additions, 11 deletions
magia.c
menu.c
+0
-1
0 additions, 1 deletion
menu.c
with
47 additions
and
20 deletions
Comandos/cmd.txt
+
2
−
2
View file @
31afeb47
...
...
@@ -24,7 +24,7 @@
25
32
31
14
2
23
19
4
...
...
@@ -33,4 +33,4 @@
30
29
28
14
22
This diff is collapsed.
Click to expand it.
colisao.h
+
4
−
3
View file @
31afeb47
...
...
@@ -36,18 +36,19 @@
#define ICEBALLS_P_PESSOA 2
#define FIREBALLS_P_PESSOA 2
/* Defines para traps */
#define TRAP_ENERGIA 50
#define TRAP_P_PESSOA 3
#define TRAP_SPRITE_WIDTH 32
#define TRAP_SPRITE_HEIGHT 32
#define TRAP_TEMPO_ARMADA
3
00
#define TRAP_TEMPO_PRENDENDO
3
0
#define TRAP_TEMPO_ARMADA
100
00
#define TRAP_TEMPO_PRENDENDO
15
0
/* Defines para flash */
#define FLASH_SPRITE_WIDTH 22
#define FLASH_SPRITE_HEIGHT 22
#define MAX_FLASH_POSSIVEL 5
typedef
struct
Pessoa
{
int
x
,
y
,
desx
,
desy
,
selx
,
sely
,
hp
;
// Desx e desy escolhem o char na imagem; Selx e sely escolhem qual sprite do char (olhando pra cima,esq,...)
int
x
,
y
,
desx
,
desy
,
selx
,
sely
,
hp
,
d
;
// Desx e desy escolhem o char na imagem; Selx e sely escolhem qual sprite do char (olhando pra cima,esq,...)
int
xneon
,
yneon
;
int
andou_b
,
andou_c
,
andou_d
,
andou_e
;
char
*
botao_b
,
*
botao_c
,
*
botao_d
,
*
botao_e
;
...
...
This diff is collapsed.
Click to expand it.
imprime.c
+
13
−
3
View file @
31afeb47
...
...
@@ -96,12 +96,16 @@ int imprime_4_chars_for(int cont,char** matriz,int *cor,bool *temneon,int njogad
p
[
i
].
yneon
+=
4
*
p
[
i
].
correr
;
}
p
[
i
].
sely
=
0
+
128
*
char4
;
if
(
!
(
p
[
i
].
andou_e
)
&&
!
(
p
[
i
].
andou_d
)
&&
!
(
p
[
i
].
andou_c
))
if
(
!
(
p
[
i
].
andou_e
)
&&
!
(
p
[
i
].
andou_d
)
&&
!
(
p
[
i
].
andou_c
))
{
if
(
p
[
i
].
freeze
<=
0
)
{
imprime_char
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
p
[
i
].
d
=
3
;
}
else
{
imprime_char_congelado
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
}
p
[
i
].
d
=
BAIXO
;
}
}
if
((
p
[
i
].
andou_e
)
==
1
)
{
// if(!(colidiu(matriz,p[i].x/4,p[i].y/4,ESQ,i,p) == 1)) { // O 1(um) tah ali porque eh o caso de andar pra esquerda.
...
...
@@ -110,11 +114,13 @@ int imprime_4_chars_for(int cont,char** matriz,int *cor,bool *temneon,int njogad
p
[
i
].
xneon
-=
4
*
p
[
i
].
correr
;
}
p
[
i
].
sely
=
32
+
128
*
char4
;
if
(
!
(
p
[
i
].
andou_d
)
&&
!
(
p
[
i
].
andou_c
))
if
(
!
(
p
[
i
].
andou_d
)
&&
!
(
p
[
i
].
andou_c
))
{
if
(
p
[
i
].
freeze
<=
0
)
{
imprime_char
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
}
else
{
imprime_char_congelado
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
}
p
[
i
].
d
=
ESQ
;
}
}
if
((
p
[
i
].
andou_d
)
==
1
)
{
...
...
@@ -124,12 +130,14 @@ int imprime_4_chars_for(int cont,char** matriz,int *cor,bool *temneon,int njogad
p
[
i
].
xneon
+=
4
*
p
[
i
].
correr
;
}
p
[
i
].
sely
=
64
+
128
*
char4
;
if
(
!
(
p
[
i
].
andou_c
))
if
(
!
(
p
[
i
].
andou_c
))
{
if
(
p
[
i
].
freeze
<=
0
)
{
imprime_char
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
}
else
{
imprime_char_congelado
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
}
p
[
i
].
d
=
DIR
;
}
}
if
((
p
[
i
].
andou_c
)
==
1
)
{
// if(!(colidiu(matriz,p[i].x/4,p[i].y/4,CIMA,i,p) == 1)) { // O 2(dois) tah ali porque eh o caso de andar pra cima.
...
...
@@ -143,6 +151,7 @@ int imprime_4_chars_for(int cont,char** matriz,int *cor,bool *temneon,int njogad
}
else
{
imprime_char_congelado
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
p
[
i
].
selx
,
p
[
i
].
sely
,
s
);
}
p
[
i
].
d
=
CIMA
;
imprime_neon
(
p
[
i
].
xneon
,
p
[
i
].
yneon
,
s
.
neons
[
i
],
temneon
[
i
]);
}
if
((
p
[
i
].
andou_b
!=
1
)
&&
(
p
[
i
].
andou_c
!=
1
)
&&
(
p
[
i
].
andou_d
!=
1
)
&&
(
p
[
i
].
andou_e
!=
1
))
{
// Nao andou.
...
...
@@ -152,6 +161,7 @@ int imprime_4_chars_for(int cont,char** matriz,int *cor,bool *temneon,int njogad
imprime_char_congelado
(
p
[
i
].
x
,
p
[
i
].
y
,
p
[
i
].
desx
,
p
[
i
].
desy
,
32
,
96
,
s
);
}
imprime_neon
(
p
[
i
].
xneon
,
p
[
i
].
yneon
,
s
.
neons
[
p
[
i
].
time
-
1
],
temneon
[
i
]);
p
[
i
].
d
=
BAIXO
;
}
}
...
...
This diff is collapsed.
Click to expand it.
keys.c
+
8
−
0
View file @
31afeb47
...
...
@@ -110,6 +110,14 @@ void keyboard_down(int evkeyboardkeycode,bool *puxa,int *flash, Pessoa *p, Magia
m
->
iceball
[
i
][
0
].
dist
=
0
;
p
[
i
].
energia
-=
50
;
}
}
else
if
(
evkeyboardkeycode
==
p
[
i
].
botao_char_int
[
TRAP
])
{
for
(
int
j
=
0
;
j
<
TRAP_P_PESSOA
;
++
j
)
{
if
(
!
m
->
trap
[
i
][
j
].
ativa
&&
p
[
i
].
energia
>=
TRAP_ENERGIA
&&
m
->
trap
[
i
][
j
].
count
<=
0
&&
p
[
i
].
freeze
<=
0
)
{
m
->
trap
[
i
][
j
].
ativa
=
true
;
p
[
i
].
energia
-=
TRAP_ENERGIA
;
break
;
}
}
}
}
/*
switch(evkeyboardkeycode) {
...
...
This diff is collapsed.
Click to expand it.
magia.c
+
20
−
11
View file @
31afeb47
...
...
@@ -262,30 +262,38 @@ void usa_trap(Pessoa *p, int njogadores, Sprite s, Magias *m) {
}
for
(
j
=
0
;
j
<
TRAP_P_PESSOA
;
++
j
)
{
if
(
m
->
trap
[
i
][
j
].
ativa
==
true
)
{
// Enquanto xsprite = 88, ele nao imprime a animacao. Quando xprite = 0, ele comeca a animacao.
m
->
trap
[
i
][
j
].
ativa
=
false
;
m
->
trap
[
i
][
j
].
count
=
TRAP_TEMPO_ARMADA
;
if
(
p
[
i
].
d
==
CIMA
)
{
m
->
trap
[
i
][
j
].
x
=
p
[
i
].
x
;
m
->
trap
[
i
][
j
].
y
=
p
[
i
].
y
+
16
;
}
else
if
(
p
[
i
].
d
==
ESQ
)
{
m
->
trap
[
i
][
j
].
x
=
p
[
i
].
x
-
16
;
m
->
trap
[
i
][
j
].
y
=
p
[
i
].
y
;
}
else
if
(
p
[
i
].
d
==
DIR
)
{
m
->
trap
[
i
][
j
].
x
=
p
[
i
].
x
+
16
;
m
->
trap
[
i
][
j
].
y
=
p
[
i
].
y
;
}
else
{
m
->
trap
[
i
][
j
].
x
=
p
[
i
].
x
;
m
->
trap
[
i
][
j
].
y
=
p
[
i
].
y
-
16
;
}
m
->
trap
[
i
][
j
].
ativa
=
false
;
m
->
trap
[
i
][
j
].
em_acao
=
false
;
m
->
trap
[
i
][
j
].
count
=
TRAP_TEMPO_ARMADA
;
}
if
(
m
->
trap
[
i
][
j
].
count
>
0
)
{
// Imprime a animação.
al_draw_bitmap_region
(
s
.
trap
,
0
,
0
,
TRAP_SPRITE_WIDTH
,
TRAP_SPRITE_HEIGHT
,
m
->
trap
[
i
][
j
].
x
,
m
->
trap
[
i
][
j
].
y
,
0
);
--
(
m
->
trap
[
i
][
j
].
count
);
for
(
k
=
0
;
k
<
njogadores
;
++
k
)
{
if
(
i
==
k
)
continue
;
// Checa se algum outro jogador pisou na trap
if
(
p
[
i
].
preso
<=
0
&&
m
->
trap
[
i
][
j
].
em_acao
==
false
&&
// Confere se o jogador nao pisou em nenhum trap e se a trap nao foi pisada por outro jogador.
p
[
i
].
x
>=
m
->
trap
[
i
][
j
].
x
&&
p
[
i
].
x
<=
m
->
trap
[
i
][
j
].
x
+
32
&&
// Colidiu no eixo X
p
[
i
].
y
>=
m
->
trap
[
i
][
j
].
y
&&
p
[
i
].
y
<=
m
->
trap
[
i
][
j
].
y
+
32
)
{
// Colidiu no eixo Y
p
[
i
].
preso
=
TRAP_TEMPO_PRENDENDO
;
if
(
i
!=
k
&&
m
->
trap
[
i
][
j
].
em_acao
==
false
&&
// Confere se a trap nao foi pisada por outro jogador e se nao eh o proprio jogador que a colocou.
p
[
k
].
x
>=
m
->
trap
[
i
][
j
].
x
-
12
&&
p
[
k
].
x
<=
m
->
trap
[
i
][
j
].
x
+
0
&&
// Colidiu no eixo X
p
[
k
].
y
>=
m
->
trap
[
i
][
j
].
y
-
16
&&
p
[
k
].
y
<=
m
->
trap
[
i
][
j
].
y
+
0
)
{
// Colidiu no eixo Y e nao eh quem colocou a trap
p
[
k
].
preso
=
(
p
[
k
].
preso
>=
TRAP_TEMPO_PRENDENDO
)
?
p
[
k
].
preso
:
TRAP_TEMPO_PRENDENDO
;
// max{ Tempo que estaria preso, Tempo que a trap prende}
m
->
trap
[
i
][
j
].
count
=
TRAP_TEMPO_PRENDENDO
;
m
->
trap
[
i
][
j
].
em_acao
=
true
;
}
}
}
}
}
}
...
...
@@ -294,6 +302,7 @@ void usa_magias(char **matriz, Pessoa *p, int njogadores, Sprite s, int *flash,
usa_flash
(
p
,
flash
,
matriz
,
njogadores
,
m
);
animacao_flash
(
p
,
njogadores
,
s
,
m
);
usa_iceball
(
matriz
,
p
,
m
,
s
,
njogadores
);
usa_trap
(
p
,
njogadores
,
s
,
m
);
// usa_fireball(matriz, p, m, njogadores);
// explosao(p, njogadores, s, m);
return
;
...
...
This diff is collapsed.
Click to expand it.
menu.c
+
0
−
1
View file @
31afeb47
...
...
@@ -44,7 +44,6 @@ void imprime_configs() {
for
(
int
i
=
0
;
i
<
PESSOAS
;
++
i
)
{
al_draw_textf
(
Font
,
AMARELO_QUEIMADO
,
100
+
x_variacao
*
i
,
100
,
0
,
"Jogador %d"
,
i
+
1
);
imprime_char
(
120
+
x_variacao
*
i
,
150
,
Pessoas
[
i
].
desx
,
Pessoas
[
i
].
desy
,
Pessoas
[
i
].
selx
,
Pessoas
[
i
].
sely
,
Sprites
);
printf
(
"Imprimindo time de %d = %d
\n
"
,
i
,
Pessoas
[
i
].
time
);
al_draw_textf
(
Font
,
Color
[
Pessoas
[
i
].
time
-
1
],
115
+
x_variacao
*
i
,
200
,
0
,
"Time %d"
,
Pessoas
[
i
].
time
);
al_draw_text
(
Font
,
CINZA_ESCURO
,
50
+
x_variacao
*
i
,
250
,
0
,
"Cima :"
);
al_draw_text
(
Font
,
CINZA_ESCURO
,
50
+
x_variacao
*
i
,
270
,
0
,
"Baixo :"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment