[ADD] simple enemy spawning

This commit is contained in:
SemvdH
2021-08-24 22:25:30 +02:00
parent 782bec825f
commit 066f625831
4 changed files with 111 additions and 90 deletions

131
Makefile
View File

@@ -1,5 +1,5 @@
# CMAKE generated file: DO NOT EDIT! # 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 executed when no arguments are given to make.
default_target: all default_target: all
@@ -17,35 +17,16 @@ default_target: all
.SUFFIXES: .SUFFIXES:
# Disable VCS-based implicit rules. # Remove some rules from gmake that .SUFFIXES does not remove.
% : %,v SUFFIXES =
# 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.%
.SUFFIXES: .hpux_make_needs_suffix_list .SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE). # Suppress display of executed commands.
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT: $(VERBOSE).SILENT:
# A target that is always out of date. # A target that is always out of date.
cmake_force: cmake_force:
@@ -61,16 +42,16 @@ SHELL = /bin/sh
CMAKE_COMMAND = /usr/bin/cmake CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file. # The command to remove a file.
RM = /usr/bin/cmake -E rm -f RM = /usr/bin/cmake -E remove -f
# Escaping for special characters. # Escaping for special characters.
EQUALS = = EQUALS = =
# The top-level source directory on which CMake was run. # 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. # 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. # Targets provided globally by CMake.
@@ -78,7 +59,7 @@ CMAKE_BINARY_DIR = /home/semtex/samples/cybershot-PSVita
# Special rule for the target rebuild_cache # Special rule for the target rebuild_cache
rebuild_cache: rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." @$(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 .PHONY : rebuild_cache
# Special rule for the target rebuild_cache # Special rule for the target rebuild_cache
@@ -99,14 +80,14 @@ edit_cache/fast: edit_cache
# The main all target # The main all target
all: cmake_check_build_system 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 $(CMAKE_COMMAND) -E cmake_progress_start /home/semtex99/vita/samples/cybershot-PSVita/CMakeFiles /home/semtex99/vita/samples/cybershot-PSVita/CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all $(MAKE) -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 0
.PHONY : all .PHONY : all
# The main clean target # The main clean target
clean: clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean $(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean .PHONY : clean
# The main clean target # The main clean target
@@ -116,12 +97,12 @@ clean/fast: clean
# Prepare targets for installation. # Prepare targets for installation.
preinstall: all preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall $(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall .PHONY : preinstall
# Prepare targets for installation. # Prepare targets for installation.
preinstall/fast: preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall $(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast .PHONY : preinstall/fast
# clear depends # clear depends
@@ -134,12 +115,12 @@ depend:
# Build rule for target. # Build rule for target.
cybershot.vpk: cmake_check_build_system cybershot.vpk: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 cybershot.vpk $(MAKE) -f CMakeFiles/Makefile2 cybershot.vpk
.PHONY : cybershot.vpk .PHONY : cybershot.vpk
# fast build rule for target. # fast build rule for target.
cybershot.vpk/fast: 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 .PHONY : cybershot.vpk/fast
#============================================================================= #=============================================================================
@@ -147,12 +128,12 @@ cybershot.vpk/fast:
# Build rule for target. # Build rule for target.
cybershot.self: cmake_check_build_system cybershot.self: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 cybershot.self $(MAKE) -f CMakeFiles/Makefile2 cybershot.self
.PHONY : cybershot.self .PHONY : cybershot.self
# fast build rule for target. # fast build rule for target.
cybershot.self/fast: 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 .PHONY : cybershot.self/fast
#============================================================================= #=============================================================================
@@ -160,40 +141,40 @@ cybershot.self/fast:
# Build rule for target. # Build rule for target.
cybershot: cmake_check_build_system cybershot: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 cybershot $(MAKE) -f CMakeFiles/Makefile2 cybershot
.PHONY : cybershot .PHONY : cybershot
# fast build rule for target. # fast build rule for target.
cybershot/fast: 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 .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 # target to build an object file
home/semtex/samples/common/debugScreen.c.obj: home/semtex99/vita/samples/common/debugScreen.c.obj:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex/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/semtex/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 # target to preprocess a source file
home/semtex/samples/common/debugScreen.c.i: home/semtex99/vita/samples/common/debugScreen.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex/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/semtex/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 # target to generate assembly for a file
home/semtex/samples/common/debugScreen.c.s: home/semtex99/vita/samples/common/debugScreen.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/cybershot.dir/build.make CMakeFiles/cybershot.dir/home/semtex/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/semtex/samples/common/debugScreen.c.s .PHONY : home/semtex99/vita/samples/common/debugScreen.c.s
src/main.obj: src/main.c.obj src/main.obj: src/main.c.obj
@@ -201,7 +182,7 @@ src/main.obj: src/main.c.obj
# target to build an object file # target to build an object file
src/main.c.obj: 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 .PHONY : src/main.c.obj
src/main.i: src/main.c.i src/main.i: src/main.c.i
@@ -210,7 +191,7 @@ src/main.i: src/main.c.i
# target to preprocess a source file # target to preprocess a source file
src/main.c.i: 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 .PHONY : src/main.c.i
src/main.s: src/main.c.s 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 # target to generate assembly for a file
src/main.c.s: 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 .PHONY : src/main.c.s
src/sprites/sprites.obj: src/sprites/sprites.c.obj 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 # target to build an object file
src/sprites/sprites.c.obj: 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 .PHONY : src/sprites/sprites.c.obj
src/sprites/sprites.i: src/sprites/sprites.c.i 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 # target to preprocess a source file
src/sprites/sprites.c.i: 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 .PHONY : src/sprites/sprites.c.i
src/sprites/sprites.s: src/sprites/sprites.c.s 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 # target to generate assembly for a file
src/sprites/sprites.c.s: 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 .PHONY : src/sprites/sprites.c.s
src/system/control_input.obj: src/system/control_input.c.obj 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 # target to build an object file
src/system/control_input.c.obj: 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 .PHONY : src/system/control_input.c.obj
src/system/control_input.i: src/system/control_input.c.i 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 # target to preprocess a source file
src/system/control_input.c.i: 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 .PHONY : src/system/control_input.c.i
src/system/control_input.s: src/system/control_input.c.s 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 # target to generate assembly for a file
src/system/control_input.c.s: 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 .PHONY : src/system/control_input.c.s
src/system/timing.obj: src/system/timing.c.obj 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 # target to build an object file
src/system/timing.c.obj: 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 .PHONY : src/system/timing.c.obj
src/system/timing.i: src/system/timing.c.i 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 # target to preprocess a source file
src/system/timing.c.i: 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 .PHONY : src/system/timing.c.i
src/system/timing.s: src/system/timing.c.s 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 # target to generate assembly for a file
src/system/timing.c.s: 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 .PHONY : src/system/timing.c.s
src/toolbox/toolbox.obj: src/toolbox/toolbox.c.obj 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 # target to build an object file
src/toolbox/toolbox.c.obj: 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 .PHONY : src/toolbox/toolbox.c.obj
src/toolbox/toolbox.i: src/toolbox/toolbox.c.i 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 # target to preprocess a source file
src/toolbox/toolbox.c.i: 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 .PHONY : src/toolbox/toolbox.c.i
src/toolbox/toolbox.s: src/toolbox/toolbox.c.s 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 # target to generate assembly for a file
src/toolbox/toolbox.c.s: 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 .PHONY : src/toolbox/toolbox.c.s
# Help Target # Help Target
@@ -336,14 +317,14 @@ help:
@echo "... all (the default if no target is provided)" @echo "... all (the default if no target is provided)"
@echo "... clean" @echo "... clean"
@echo "... depend" @echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache" @echo "... rebuild_cache"
@echo "... cybershot.self" @echo "... edit_cache"
@echo "... cybershot.vpk" @echo "... cybershot.vpk"
@echo "... cybershot.self"
@echo "... cybershot" @echo "... cybershot"
@echo "... home/semtex/samples/common/debugScreen.obj" @echo "... home/semtex99/vita/samples/common/debugScreen.obj"
@echo "... home/semtex/samples/common/debugScreen.i" @echo "... home/semtex99/vita/samples/common/debugScreen.i"
@echo "... home/semtex/samples/common/debugScreen.s" @echo "... home/semtex99/vita/samples/common/debugScreen.s"
@echo "... src/main.obj" @echo "... src/main.obj"
@echo "... src/main.i" @echo "... src/main.i"
@echo "... src/main.s" @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 # Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX) if(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -32,11 +32,6 @@ if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "TRUE") set(CMAKE_CROSSCOMPILING "TRUE")
endif() 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) if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else() else()
@@ -45,5 +40,5 @@ endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}") "${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}") "${CMAKE_INSTALL_MANIFEST_CONTENT}")

View File

@@ -51,7 +51,8 @@ SceUInt64 deltaTime = 0; // delta time in ms
SceKernelSysClock sysclock; SceKernelSysClock sysclock;
timing_timer bullet_timer = {0, 250, 0}; // 0 as starting time, 250 ms timeout, not elapsed timing_timer bullet_timer = {0, 250, 0}; // 0 as starting time, 250 ms timeout, not elapsed
timing_timer menu_switch_input_delay_timer = {0, 200, 0}; // 0 as starting time, 100 ms timeout, not elapsed timing_timer menu_switch_input_delay_timer = {0, 200, 0}; // 0 as starting time, 100 ms timeout, not elapsed
timing_timer score_timer = {0, 100, 0}; timing_timer score_timer = {0, 100, 0}; // timer to update score
timing_timer enemy_spawn_timer = {0, 500, 0}; // timer to spawn a new enemy
ENEMY_SPRITE enemies[SIMPLE_ENEMY_MAX_AMOUNT]; ENEMY_SPRITE enemies[SIMPLE_ENEMY_MAX_AMOUNT];
uint32_t enemy_count; uint32_t enemy_count;
@@ -114,12 +115,16 @@ void init_sprites()
// add simple enemies // add simple enemies
for (i = 0; i < SIMPLE_ENEMY_MAX_AMOUNT; i++) 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}; ENEMY_SPRITE e = {NONACTIVE, SIMPLE, 20 * i + 10, 10, RGBA8(245, 90, 66, 255), 1.0};
enemies[i] = e; enemies[i] = e;
enemy_count++; enemy_count++;
} }
} }
/**
* @brief generates a bullet
*
*/
void generate_bullet() void generate_bullet()
{ {
// {1, x1_pos, y1_pos, RGBA8(100, 100, 0, 255)}; // {1, x1_pos, y1_pos, RGBA8(100, 100, 0, 255)};
@@ -130,6 +135,10 @@ void generate_bullet()
current_bullet = (current_bullet + 1) % 254; current_bullet = (current_bullet + 1) % 254;
} }
/**
* @brief generates a smoke particle
*
*/
void generate_smoke_particle() void generate_smoke_particle()
{ {
smoke_particles[current_smoke_particle].active = ACTIVE; smoke_particles[current_smoke_particle].active = ACTIVE;
@@ -140,6 +149,24 @@ void generate_smoke_particle()
current_smoke_particle = (current_smoke_particle + 1) % 254; current_smoke_particle = (current_smoke_particle + 1) % 254;
} }
/**
* @brief generates a simple enemy
*
*/
void generate_simple_enemy()
{
for (int i = 0; i < SIMPLE_ENEMY_MAX_AMOUNT; i++)
{
if (enemies[i].active == NONACTIVE)
{
enemies[i].active = ACTIVE;
enemies[i].x = toolbox_random_float(0, SCREEN_WIDTH - 1);
enemies[i].y = 0;
break;
}
}
}
// ################################################################ // ################################################################
// ------------------------ END GENERATE SPRITES ------------------ // ------------------------ END GENERATE SPRITES ------------------
// ################################################################ // ################################################################
@@ -306,6 +333,8 @@ void update_game()
timing_check_timer_elapsed(&bullet_timer); timing_check_timer_elapsed(&bullet_timer);
timing_update_timer(&score_timer, deltaTime); timing_update_timer(&score_timer, deltaTime);
timing_check_timer_elapsed(&score_timer); timing_check_timer_elapsed(&score_timer);
timing_update_timer(&enemy_spawn_timer, deltaTime);
timing_check_timer_elapsed(&enemy_spawn_timer);
if (cross_pressed) if (cross_pressed)
{ {
@@ -337,7 +366,7 @@ void update_game()
menu_switch_input_delay_timer.elapsed = 0; menu_switch_input_delay_timer.elapsed = 0;
return; return;
} }
if (score_timer.elapsed) if (score_timer.elapsed)
score += 1; score += 1;
@@ -360,6 +389,24 @@ void update_game()
if (smoke_particles[i].radius <= 0) if (smoke_particles[i].radius <= 0)
smoke_particles[i].active = 0; smoke_particles[i].active = 0;
} }
if (enemy_spawn_timer.elapsed)
{
generate_simple_enemy();
enemy_spawn_timer.elapsed = 0;
}
for (int i = 0; i < SIMPLE_ENEMY_MAX_AMOUNT; i++)
{
if (enemies[i].active == ACTIVE)
{
enemies[i].y += enemies[i].movement_speed;
if (enemies[i].y >= SCREEN_HEIGTH + SIMPLE_ENEMY_SIZE)
{
enemies[i].active = NONACTIVE;
}
}
}
} }
void update_gameover() void update_gameover()
@@ -459,14 +506,14 @@ void draw_game()
} }
char score_text[40]; char score_text[40];
sprintf(score_text,"score: %07d",score); sprintf(score_text, "score: %07d", score);
vita2d_pvf_draw_text(pvf, 700, 100, RGBA8(0, 255, 0, 255), 1.0f, score_text); vita2d_pvf_draw_text(pvf, 700, 100, RGBA8(0, 255, 0, 255), 1.0f, score_text);
} }
void draw_gameover() void draw_gameover()
{ {
char score_text[40]; char score_text[40];
sprintf(score_text,"score: %07d",score); sprintf(score_text, "score: %07d", score);
vita2d_pvf_draw_text(pvf, 700, 80, RGBA8(0, 255, 0, 255), 1.0f, "Game over"); vita2d_pvf_draw_text(pvf, 700, 80, RGBA8(0, 255, 0, 255), 1.0f, "Game over");
vita2d_pvf_draw_text(pvf, 700, 100, RGBA8(0, 255, 0, 255), 1.0f, score_text); vita2d_pvf_draw_text(pvf, 700, 100, RGBA8(0, 255, 0, 255), 1.0f, score_text);
} }

View File

@@ -28,7 +28,7 @@ void sprites_draw_player(float x, float y, float scale)
float random_size = toolbox_random_float(scale, 5.0 * scale); float random_size = toolbox_random_float(scale, 5.0 * scale);
vita2d_draw_line(x - 1.0 * scale, y, x, y + random_size, RGBA8(255, 0, 0, 200)); vita2d_draw_line(x - 1.0 * scale, y, x, y + random_size, RGBA8(255, 0, 0, 200));
vita2d_draw_line(x, y + random_size, x + 1.0 * scale, y, RGBA8(255, 0, 0, 200)); vita2d_draw_line(x, y + random_size, x + 1.0 * scale, y, RGBA8(255, 0, 0, 200));
//left side //left side
vita2d_draw_line(x - 2.0 * scale, y, x + 2.0 * scale, y, SHIP_PRIMARY_COLOR); vita2d_draw_line(x - 2.0 * scale, y, x + 2.0 * scale, y, SHIP_PRIMARY_COLOR);
vita2d_draw_line(x - 2.0 * scale, y, x - 1.0 * scale, y - 2.0 * scale, SHIP_PRIMARY_COLOR); vita2d_draw_line(x - 2.0 * scale, y, x - 1.0 * scale, y - 2.0 * scale, SHIP_PRIMARY_COLOR);
@@ -39,7 +39,6 @@ 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, 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 - 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); 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) void sprites_draw_enemy(ENEMY_SPRITE *enemy)
@@ -60,5 +59,4 @@ void sprites_draw_simple_enemy(ENEMY_SPRITE *enemy)
void sprites_draw_complex_enemy(ENEMY_SPRITE *enemy) void sprites_draw_complex_enemy(ENEMY_SPRITE *enemy)
{ {
} }