patterns
This commit is contained in:
parent
4eb20ea52c
commit
113192f897
1 changed files with 43 additions and 5 deletions
48
patterns.c
48
patterns.c
|
@ -10,11 +10,9 @@
|
|||
#include "obs.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
pattern_copyleft(struct s_game *g) {
|
||||
pattern_copyleft_spec(struct s_game *g, int cleared_face) {
|
||||
int times;
|
||||
int cleared_face = rand() % g->polygon_type;
|
||||
int max_dist = get_max_obs_dist(g);
|
||||
|
||||
for(times = 0; times < g->polygon_type; times++) {
|
||||
|
@ -26,6 +24,43 @@ pattern_copyleft(struct s_game *g) {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
pattern_copyleft(struct s_game *g) {
|
||||
pattern_copyleft_spec(g, rand() % g->polygon_type);
|
||||
}
|
||||
|
||||
void
|
||||
pattern_copy3left(struct s_game *g) {
|
||||
pattern_copyleft_spec(g, 0);
|
||||
pattern_copyleft_spec(g, g->polygon_type/2);
|
||||
pattern_copyleft_spec(g, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pattern_opposing_forces(struct s_game *g) {
|
||||
int times;
|
||||
int max_dist = get_max_obs_dist(g);
|
||||
int cleared_face = rand() % g->polygon_type;
|
||||
|
||||
for(times = 0; times < g->polygon_type; times+=2) {
|
||||
struct s_obstacle o;
|
||||
o = create_obstacle(SHAPE_THICK,
|
||||
(times + cleared_face)%g->polygon_type,
|
||||
1, max_dist + K_CLEARANCE);
|
||||
add_obstacle(g, o);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pattern_3opposing_forces(struct s_game *g) {
|
||||
pattern_opposing_forces(g);
|
||||
pattern_opposing_forces(g);
|
||||
pattern_opposing_forces(g);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
pattern_schenille(struct s_game *g) {
|
||||
int times;
|
||||
|
@ -52,9 +87,12 @@ pattern_schenille(struct s_game *g) {
|
|||
|
||||
void
|
||||
add_pattern(struct s_game *g) {
|
||||
int n_patterns = 2;
|
||||
int n_patterns = 5;
|
||||
void (*patterns[])(struct s_game *g) = {pattern_copyleft,
|
||||
pattern_schenille};
|
||||
pattern_schenille,
|
||||
pattern_copy3left,
|
||||
pattern_opposing_forces,
|
||||
pattern_3opposing_forces};
|
||||
|
||||
int choosen_pattern = rand() % n_patterns;
|
||||
|
||||
|
|
Loading…
Reference in a new issue