Jump to content
  • Advertisement

Sae Mu

Member
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Sae Mu

  • Rank
    Newbie

Personal Information

  • Interests
    Art
    Audio
    Design
    Programming
  1. I'm using Notepad++ #include "structs.inc.c" etc. works fine thank's
  2. thank you for the answer. I want to stick all the Gamelevel Plattform of dynamic_pfl into one Array. I want something like this. //highest_amount_of_dynamic_pfl_in_this_game on level 6 are 20 instances //level 1 contains 5 Plattforms of dynamic_pfl; struct dynamic_pfl arr_dynamic_pfl[1][highest_amount_of_dynamic_pfl_in_this_game] = { {false,1,4,2,40,0,0,420,580,0,128,64,0}, {false,2,4,2,40,0,0,1200,580,0,128,64,0}, {false,1,4,2,40,0,0,111,580,0,128,64,0}, {false,2,4,2,40,0,0,2222,580,0,128,64,0}, {false,2,4,2,40,0,0,666,580,0,128,64,0} }; //level 2 contains 3 Plattforms of dynamic_pfl; struct dynamic_pfl arr_dynamic_pfl[2][highest_amount_of_dynamic_pfl_in_this_game] = { {false,1,4,2,40,0,0,111,280,0,128,64,0}, {false,2,4,2,40,0,0,111,380,0,128,64,0}, {false,1,4,2,40,0,0,111,480,0,128,64,0} }; //level 3 contains 4 Plattforms of dynamic_pfl; struct dynamic_pfl arr_dynamic_pfl[3][highest_amount_of_dynamic_pfl_in_this_game] = { {false,1,4,2,40,0,0,131,2180,0,128,64,0}, {false,2,4,2,40,0,0,141,3180,0,128,64,0}, {false,1,4,2,40,0,0,151,4180,0,128,64,0}, {false,1,4,2,40,0,0,161,4180,0,128,64,0} };
  3. I'm a beginner in C, maybee I don't understand arrays in C because as Webdeveloper I used Languages like ASP, Python, PHP, Javascript and Actionscript it was easier. My Goal is a two-dimensional array. First dimension: should contain the current level of the game, second dimension: object structure. When I compile and execute it seems, the first dimension is used as a structure. C:\_dev>gcc struct_def.c -o struct_def.exe -lmingw32 C:\_dev>struct_def.exe result x = 420.000000 x = 0.000000 < instead of 1200.000000 C:\_dev> The Game is very small and I would like to hardcode all the level data. without having to load the levels dynamically and without malloc. I want to iterate the array and refresh all the positions and making collision checks etc. then iterate the array again to calculate wich object are inside the camera to draw. How can I use the array as I would like it? First dimension: Level, second dimension: all the struct data? thank's for helping 😊 C ISO C98 <code> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> struct dynamic_pfl{ bool player; int type; int pause_time; int moving_dir; float mspeed; float hspeed; float vspeed; float x; float y; float friction; int width; int height; int state; }; int main(){ int level = 5; //max levels of the game struct dynamic_pfl arr_dynamic_pfl[level][20] = { {false,1,4,2,40,0,0,420,580,0,128,64,0}, {false,2,4,2,40,0,0,1200,580,0,128,64,0}, {false,1,4,2,40,0,0,111,580,0,128,64,0}, {false,2,4,2,40,0,0,2222,580,0,128,64,0}, {false,2,4,2,40,0,0,666,580,0,128,64,0} }; printf("result\n"); printf("x = %f\n",arr_dynamic_pfl[0][0].x); printf("x = %f",arr_dynamic_pfl[0][1].x); return 0; } </code>
  4. on any location in the Source Code like in my example?
  5. Which the compiler then composes? Like in PHP? #include <stdio.h> require `inc_struct_declarations.c`; require `inc_functions.c`; int main() { require `inc_var_declarations.c`; require `inc_keyb_events.c`; require `inc_game_logic.c`; require `inc_gfx_output.c`; return 0; }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!