#include "raylib.h" #define MAX_BULLETS 10 struct blueBullet{ bool active; Vector2 position; Vector2 movement; }blueBullet; int main(void) { // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib example."); // This is one way to create a new array of struct! struct blueBullet arr_blueBullet[2] = { {true,(Vector2){400,200},(Vector2){2.5f,0.0f}}, {true,(Vector2){400,200},(Vector2){-2.5f,0.0f}} }; // This is another way of creating a array of struct. struct blueBullet arr_blueBullet2[MAX_BULLETS]; for(int i=0;iscreenWidth+10 || arr_blueBullet[i].position.y<-10 || arr_blueBullet[i].position.y>screenHeight-10){ arr_blueBullet[i].position = (Vector2){400,200}; } } } // Update bluebullets2 for(int i=0;iscreenWidth+10 || arr_blueBullet2[i].position.y<-10 || arr_blueBullet2[i].position.y>screenHeight-10){ arr_blueBullet2[i].position = (Vector2){400,200}; } } } //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(RAYWHITE); // Draw blueBullets for(int i=0;i<2;i++){ if(arr_blueBullet[i].active){ DrawRectangle(arr_blueBullet[i].position.x,arr_blueBullet[i].position.y,5,5,BLUE); } } // Draw blueBullets2 for(int i=0;i