[ADD] simple enemy sprite

This commit is contained in:
SemvdH
2021-06-30 19:13:58 +02:00
parent 6870625fd6
commit 4071aa3938
5 changed files with 166 additions and 104 deletions

131
Makefile
View File

@@ -1,5 +1,5 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.18
# Generated by "Unix Makefiles" Generator, CMake Version 3.16
# Default target executed when no arguments are given to make.
default_target: all
@@ -17,35 +17,16 @@ default_target: all
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
@@ -61,16 +42,16 @@ SHELL = /bin/sh
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E rm -f
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/semtex/samples/cybershot-PSVita
CMAKE_SOURCE_DIR = /home/semtex99/vita/samples/cybershot-PSVita
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/semtex/samples/cybershot-PSVita
CMAKE_BINARY_DIR = /home/semtex99/vita/samples/cybershot-PSVita
#=============================================================================
# Targets provided globally by CMake.
@@ -78,7 +59,7 @@ CMAKE_BINARY_DIR = /home/semtex/samples/cybershot-PSVita
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
/usr/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
@@ -99,14 +80,14 @@ edit_cache/fast: edit_cache
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/semtex/samples/cybershot-PSVita/CMakeFiles /home/semtex/samples/cybershot-PSVita//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/semtex/samples/cybershot-PSVita/CMakeFiles 0
$(CMAKE_COMMAND) -E cmake_progress_start /home/semtex99/vita/samples/cybershot-PSVita/CMakeFiles /home/semtex99/vita/samples/cybershot-PSVita/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/semtex99/vita/samples/cybershot-PSVita/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
@@ -116,12 +97,12 @@ clean/fast: clean
# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
@@ -134,12 +115,12 @@ depend:
# Build rule for target.
cybershot.vpk: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 cybershot.vpk
$(MAKE) -f CMakeFiles/Makefile2 cybershot.vpk
.PHONY : cybershot.vpk
# fast build rule for target.
cybershot.vpk/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.vpk.dir/build.make CMakeFiles/cybershot.vpk.dir/build
$(MAKE) -f CMakeFiles/cybershot.vpk.dir/build.make CMakeFiles/cybershot.vpk.dir/build
.PHONY : cybershot.vpk/fast
#=============================================================================
@@ -147,12 +128,12 @@ cybershot.vpk/fast:
# Build rule for target.
cybershot.self: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 cybershot.self
$(MAKE) -f CMakeFiles/Makefile2 cybershot.self
.PHONY : cybershot.self
# fast build rule for target.
cybershot.self/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.self.dir/build.make CMakeFiles/cybershot.self.dir/build
$(MAKE) -f CMakeFiles/cybershot.self.dir/build.make CMakeFiles/cybershot.self.dir/build
.PHONY : cybershot.self/fast
#=============================================================================
@@ -160,40 +141,40 @@ cybershot.self/fast:
# Build rule for target.
cybershot: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 cybershot
$(MAKE) -f CMakeFiles/Makefile2 cybershot
.PHONY : cybershot
# fast build rule for target.
cybershot/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/build
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/build
.PHONY : cybershot/fast
home/semtex/samples/common/debugScreen.obj: home/semtex/samples/common/debugScreen.c.obj
home/semtex99/vita/samples/common/debugScreen.obj: home/semtex99/vita/samples/common/debugScreen.c.obj
.PHONY : home/semtex/samples/common/debugScreen.obj
.PHONY : home/semtex99/vita/samples/common/debugScreen.obj
# target to build an object file
home/semtex/samples/common/debugScreen.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex/samples/common/debugScreen.c.obj
.PHONY : home/semtex/samples/common/debugScreen.c.obj
home/semtex99/vita/samples/common/debugScreen.c.obj:
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex99/vita/samples/common/debugScreen.c.obj
.PHONY : home/semtex99/vita/samples/common/debugScreen.c.obj
home/semtex/samples/common/debugScreen.i: home/semtex/samples/common/debugScreen.c.i
home/semtex99/vita/samples/common/debugScreen.i: home/semtex99/vita/samples/common/debugScreen.c.i
.PHONY : home/semtex/samples/common/debugScreen.i
.PHONY : home/semtex99/vita/samples/common/debugScreen.i
# target to preprocess a source file
home/semtex/samples/common/debugScreen.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex/samples/common/debugScreen.c.i
.PHONY : home/semtex/samples/common/debugScreen.c.i
home/semtex99/vita/samples/common/debugScreen.c.i:
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex99/vita/samples/common/debugScreen.c.i
.PHONY : home/semtex99/vita/samples/common/debugScreen.c.i
home/semtex/samples/common/debugScreen.s: home/semtex/samples/common/debugScreen.c.s
home/semtex99/vita/samples/common/debugScreen.s: home/semtex99/vita/samples/common/debugScreen.c.s
.PHONY : home/semtex/samples/common/debugScreen.s
.PHONY : home/semtex99/vita/samples/common/debugScreen.s
# target to generate assembly for a file
home/semtex/samples/common/debugScreen.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex/samples/common/debugScreen.c.s
.PHONY : home/semtex/samples/common/debugScreen.c.s
home/semtex99/vita/samples/common/debugScreen.c.s:
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex99/vita/samples/common/debugScreen.c.s
.PHONY : home/semtex99/vita/samples/common/debugScreen.c.s
src/main.obj: src/main.c.obj
@@ -201,7 +182,7 @@ src/main.obj: src/main.c.obj
# target to build an object file
src/main.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/main.c.obj
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/main.c.obj
.PHONY : src/main.c.obj
src/main.i: src/main.c.i
@@ -210,7 +191,7 @@ src/main.i: src/main.c.i
# target to preprocess a source file
src/main.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/main.c.i
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/main.c.i
.PHONY : src/main.c.i
src/main.s: src/main.c.s
@@ -219,7 +200,7 @@ src/main.s: src/main.c.s
# target to generate assembly for a file
src/main.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/main.c.s
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/main.c.s
.PHONY : src/main.c.s
src/sprites/sprites.obj: src/sprites/sprites.c.obj
@@ -228,7 +209,7 @@ src/sprites/sprites.obj: src/sprites/sprites.c.obj
# target to build an object file
src/sprites/sprites.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/sprites/sprites.c.obj
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/sprites/sprites.c.obj
.PHONY : src/sprites/sprites.c.obj
src/sprites/sprites.i: src/sprites/sprites.c.i
@@ -237,7 +218,7 @@ src/sprites/sprites.i: src/sprites/sprites.c.i
# target to preprocess a source file
src/sprites/sprites.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/sprites/sprites.c.i
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/sprites/sprites.c.i
.PHONY : src/sprites/sprites.c.i
src/sprites/sprites.s: src/sprites/sprites.c.s
@@ -246,7 +227,7 @@ src/sprites/sprites.s: src/sprites/sprites.c.s
# target to generate assembly for a file
src/sprites/sprites.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/sprites/sprites.c.s
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/sprites/sprites.c.s
.PHONY : src/sprites/sprites.c.s
src/system/control_input.obj: src/system/control_input.c.obj
@@ -255,7 +236,7 @@ src/system/control_input.obj: src/system/control_input.c.obj
# target to build an object file
src/system/control_input.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/control_input.c.obj
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/control_input.c.obj
.PHONY : src/system/control_input.c.obj
src/system/control_input.i: src/system/control_input.c.i
@@ -264,7 +245,7 @@ src/system/control_input.i: src/system/control_input.c.i
# target to preprocess a source file
src/system/control_input.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/control_input.c.i
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/control_input.c.i
.PHONY : src/system/control_input.c.i
src/system/control_input.s: src/system/control_input.c.s
@@ -273,7 +254,7 @@ src/system/control_input.s: src/system/control_input.c.s
# target to generate assembly for a file
src/system/control_input.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/control_input.c.s
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/control_input.c.s
.PHONY : src/system/control_input.c.s
src/system/timing.obj: src/system/timing.c.obj
@@ -282,7 +263,7 @@ src/system/timing.obj: src/system/timing.c.obj
# target to build an object file
src/system/timing.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.obj
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.obj
.PHONY : src/system/timing.c.obj
src/system/timing.i: src/system/timing.c.i
@@ -291,7 +272,7 @@ src/system/timing.i: src/system/timing.c.i
# target to preprocess a source file
src/system/timing.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.i
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.i
.PHONY : src/system/timing.c.i
src/system/timing.s: src/system/timing.c.s
@@ -300,7 +281,7 @@ src/system/timing.s: src/system/timing.c.s
# target to generate assembly for a file
src/system/timing.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.s
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/system/timing.c.s
.PHONY : src/system/timing.c.s
src/toolbox/toolbox.obj: src/toolbox/toolbox.c.obj
@@ -309,7 +290,7 @@ src/toolbox/toolbox.obj: src/toolbox/toolbox.c.obj
# target to build an object file
src/toolbox/toolbox.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/toolbox.c.obj
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/toolbox.c.obj
.PHONY : src/toolbox/toolbox.c.obj
src/toolbox/toolbox.i: src/toolbox/toolbox.c.i
@@ -318,7 +299,7 @@ src/toolbox/toolbox.i: src/toolbox/toolbox.c.i
# target to preprocess a source file
src/toolbox/toolbox.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/toolbox.c.i
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/toolbox.c.i
.PHONY : src/toolbox/toolbox.c.i
src/toolbox/toolbox.s: src/toolbox/toolbox.c.s
@@ -327,7 +308,7 @@ src/toolbox/toolbox.s: src/toolbox/toolbox.c.s
# target to generate assembly for a file
src/toolbox/toolbox.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/toolbox.c.s
$(MAKE) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/src/toolbox/toolbox.c.s
.PHONY : src/toolbox/toolbox.c.s
# Help Target
@@ -336,14 +317,14 @@ help:
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... cybershot.self"
@echo "... edit_cache"
@echo "... cybershot.vpk"
@echo "... cybershot.self"
@echo "... cybershot"
@echo "... home/semtex/samples/common/debugScreen.obj"
@echo "... home/semtex/samples/common/debugScreen.i"
@echo "... home/semtex/samples/common/debugScreen.s"
@echo "... home/semtex99/vita/samples/common/debugScreen.obj"
@echo "... home/semtex99/vita/samples/common/debugScreen.i"
@echo "... home/semtex99/vita/samples/common/debugScreen.s"
@echo "... src/main.obj"
@echo "... src/main.i"
@echo "... src/main.s"

View File

@@ -1,4 +1,4 @@
# Install script for directory: /home/semtex/samples/cybershot-PSVita
# Install script for directory: /home/semtex99/vita/samples/cybershot-PSVita
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -32,11 +32,6 @@ if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "TRUE")
endif()
# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/local/vitasdk/bin/arm-vita-eabi-objdump")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
@@ -45,5 +40,5 @@ endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/home/semtex/samples/cybershot-PSVita/${CMAKE_INSTALL_MANIFEST}"
file(WRITE "/home/semtex99/vita/samples/cybershot-PSVita/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")

View File

@@ -40,6 +40,7 @@ SceKernelSysClock sysclock;
timing_timer bullet_timer = {0, 250, 0}; // 0 as starting time, 400 ms timeout, not elapsed
timer_t bullt = 0;
ENEMY_SPRITE simple_enemies[SIMPLE_ENEMY_MAX_AMOUNT];
float player_x = 300, player_y = 50, x2_pos = 400, y2_pos = 50, radius = 5.0;
@@ -58,7 +59,7 @@ __attribute__((__noreturn__)) void shit_yourself(void)
void generate_bullet()
{
// {1, x1_pos, y1_pos, RGBA8(100, 100, 0, 255)};
bullets[current_bullet].active = 1;
bullets[current_bullet].active = ACTIVE;
bullets[current_bullet].x = player_x;
bullets[current_bullet].y = player_y - SHIP_HEIGHT;
bullets[current_bullet].color = RGBA8(255, 100, 0, 255);
@@ -67,7 +68,7 @@ void generate_bullet()
void generate_smoke_particle()
{
smoke_particles[current_smoke_particle].active = 1;
smoke_particles[current_smoke_particle].active = ACTIVE;
smoke_particles[current_smoke_particle].x = player_x;
smoke_particles[current_smoke_particle].y = player_y - SHIP_HEIGHT;
smoke_particles[current_smoke_particle].radius = SMOKE_START_RADIUS;
@@ -87,18 +88,24 @@ void init()
pvf = vita2d_load_default_pvf();
memset(&pad, 0, sizeof(pad));
for (int i = 0; i < 255; i++)
int i;
for (i = 0; i < 255; i++)
{
BULLET temp = {0, 0, 100, RGBA8(0, i, 255, 255), 300.0};
BULLET temp = {NONACTIVE, 0, 100, RGBA8(0, i, 255, 255), 300.0};
bullets[i] = temp;
}
for (int i = 0; i < 255; i++)
for (i = 0; i < 255; i++)
{
SMOKE_PARTICLE s = {0, 0, 0, SMOKE_START_RADIUS};
SMOKE_PARTICLE s = {NONACTIVE, 0, 0, SMOKE_START_RADIUS};
smoke_particles[i] = s;
}
for (i = 0; i < SIMPLE_ENEMY_MAX_AMOUNT; i++)
{
ENEMY_SPRITE e = {ACTIVE, SIMPLE, 20 * i + 10, 10, RGBA8(245, 90, 66, 255), 1.0};
simple_enemies[i] = e;
}
}
void update()
@@ -154,8 +161,8 @@ void update()
bullets[i].active = 0;
}
smoke_particles[i].radius += smoke_particles[i].explosion_direction * (SMOKE_DISSAPPEAR_SPEED * (deltaTime / 1000.0)) * (SMOKE_MAX_RADIUS/smoke_particles[i].radius);
smoke_particles[i].radius += smoke_particles[i].explosion_direction * (SMOKE_DISSAPPEAR_SPEED * (deltaTime / 1000.0)) * (SMOKE_MAX_RADIUS / smoke_particles[i].radius);
if (smoke_particles[i].radius >= SMOKE_MAX_RADIUS)
smoke_particles[i].explosion_direction = -1;
@@ -169,11 +176,11 @@ void draw()
vita2d_start_drawing();
vita2d_clear_screen();
sprites_draw_player(player_x, player_y, 3.0);
sprites_draw_player(player_x, player_y, PLAYER_SCALE);
// vita2d_draw_rectangle(x2_pos, y2_pos, (float)10, (float)10, RGBA8(169, 60, 23, 255));
char text[80] = "process time: ";
sprintf(text, "%lld ms", deltaTime);
sprintf(text, "%f", simple_enemies[5].x);
char fps[15] = "fps: ";
sprintf(fps, "%d", timing_get_fps(deltaTime));
@@ -192,6 +199,11 @@ void draw()
sprites_draw_smoke_circle(&smoke_particles[i]);
}
for (int i = 0; i < SIMPLE_ENEMY_MAX_AMOUNT; i++)
{
sprites_draw_enemy(&simple_enemies[i]);
}
vita2d_end_drawing();
vita2d_swap_buffers();
}

View File

@@ -2,17 +2,19 @@
#define printf psvDebugScreenPrintf
void (*enemy_draw_functions[2])(ENEMY_SPRITE *enemy_sprite) = {sprites_draw_simple_enemy, sprites_draw_complex_enemy};
void sprites_draw_bullet(BULLET *bullet)
{
if (bullet->active)
if (bullet->active == ACTIVE)
{
vita2d_draw_rectangle(bullet->x, bullet->y, (float)3, (float)8, bullet->color);
vita2d_draw_rectangle(bullet->x, bullet->y, (float)BULLET_WIDTH, (float)BULLET_HEIGTH, bullet->color);
}
}
void sprites_draw_smoke_circle(SMOKE_PARTICLE *smoke_particle)
{
if (smoke_particle->active)
if (smoke_particle->active == ACTIVE)
{
vita2d_draw_fill_circle(smoke_particle->x, smoke_particle->y, smoke_particle->radius, RGBA8(232, 232, 232, 200));
}
@@ -20,6 +22,7 @@ void sprites_draw_smoke_circle(SMOKE_PARTICLE *smoke_particle)
void sprites_draw_player(float x, float y, float scale)
{
// bounding box: x -/+ 2.0 * scale, y - 5.0 * scale
// bottom fire
float random_size = toolbox_random_float(scale, 5.0 * scale);
@@ -36,5 +39,25 @@ void sprites_draw_player(float x, float y, float scale)
vita2d_draw_line(x, y - 5.0 * scale, x + 1.0 * scale, y - 4.0 * scale, SHIP_PRIMARY_COLOR);
vita2d_draw_line(x + 1.0 * scale, y - 4.0 * scale, x + 1.0 * scale, y - 2.0 * scale, SHIP_PRIMARY_COLOR);
vita2d_draw_line(x + 1.0 * scale, y - 2.0 * scale, x + 2.0 * scale, y, SHIP_PRIMARY_COLOR);
}
void sprites_draw_enemy(ENEMY_SPRITE *enemy)
{
if (enemy->active == ACTIVE)
{
(*enemy_draw_functions[enemy->enemy_type])(enemy);
}
}
void sprites_draw_simple_enemy(ENEMY_SPRITE *enemy)
{
vita2d_draw_line(enemy->x - 9.0, enemy->y, enemy->x, enemy->y + 9.0, enemy->color);
vita2d_draw_line(enemy->x, enemy->y + 9.0, enemy->x + 9.0, enemy->y, enemy->color);
vita2d_draw_line(enemy->x + 9.0, enemy->y, enemy->x, enemy->y - 9.0, enemy->color);
vita2d_draw_line(enemy->x, enemy->y - 9.0, enemy->x - 9.0, enemy->y, enemy->color);
}
void sprites_draw_complex_enemy(ENEMY_SPRITE *enemy)
{
}

View File

@@ -13,29 +13,58 @@
#define SHIP_SECONDARY_COLOR RGBA8(153, 153, 153, 255)
#define SHIP_PRIMARY_COLOR RGBA8(0, 255, 195, 255)
#define SHIP_WIDTH 12; // 3 * 4
#define SHIP_HEIGHT 15; // 3 * 5
#define SHIP_WIDTH 4
#define SHIP_HEIGHT 5
#define BULLET_WIDTH 3
#define BULLET_HEIGTH 8
#define PLAYER_SCALE 3.0
#define SMOKE_START_RADIUS 8.0
#define SMOKE_MAX_RADIUS 10.0
#define SMOKE_DISSAPPEAR_SPEED 35.0
#define SIMPLE_ENEMY_MAX_AMOUNT 10
typedef enum
{
SIMPLE,
COMPLEX
} ENEMY_TYPE;
typedef enum
{
NONACTIVE,
ACTIVE
} SPRITE_ACTIVE;
/**
* @brief a struct that holds a bullet sprite, basically a rectangle
* @brief a struct that holds a bullet sprite, basically a rectangle.
* there will be at most a few bullets available
*/
typedef struct bullet_sprite_t
typedef struct sprite_t
{
size_t active; // whether or not the bullet should be drawn (0 or 1)
SPRITE_ACTIVE active; // whether or not the sprite should be drawn (0 or 1)
float x; // the x position
float y; // the y position
unsigned int color; // color of the bullet
float movement_speed; // speed of the bullet (how much it should move each frame)
unsigned int color; // color of the sprite
float movement_speed; // speed of the sprite (how much it should move each frame)
} BULLET;
typedef struct enemy_sprite_t
{
SPRITE_ACTIVE active; // whether or not the sprite should be drawn (0 or 1)
ENEMY_TYPE enemy_type; // type of enemy
float x; // the x position
float y; // the y position
unsigned int color; // color of the sprite
float movement_speed; // speed of the sprite (how much it should move each frame)
} ENEMY_SPRITE;
typedef struct smoke_particle_t
{
size_t active; // whether or not to draw the smoke circle (0 or 1)
SPRITE_ACTIVE active; // whether or not to draw the smoke circle (0 or 1)
float x; // x position
float y; // y position
float radius; // radius of circle
@@ -66,4 +95,26 @@ void sprites_draw_player(float x, float y, float scale);
*/
void sprites_draw_smoke_circle(SMOKE_PARTICLE *smoke_particle);
/**
* @brief draws an enemy sprite
*
* @param enemy_sprite the sprite to draw
*/
void sprites_draw_enemy(ENEMY_SPRITE *enemy_sprite);
/**
* @brief draws the simple enemy
*
* @param enemy_sprite the enemy sprite struct
*/
void sprites_draw_simple_enemy(ENEMY_SPRITE *enemy);
/**
* @brief draws the complex enemy
*
* @param enemy_sprite the enemy sprite struct
*/
void sprites_draw_complex_enemy(ENEMY_SPRITE *enemy);
#endif