diff --git a/.legend b/.legend new file mode 100644 index 0000000..1930fef --- /dev/null +++ b/.legend @@ -0,0 +1,96 @@ +The map is an xml. + +You have prefabs or complete scenes. + +A scene must have the tag and should contains a tag with every +static data to load with the scene (for the sfml, you have the , +and tags). + +A scene or a prefab may have a tag listing every entity that needs +to be created. + +To define an entity, use the tag and put components +inside the entity. + + +Valid components and there properties are: + + transform_component: allow the entity to be placed on the map. + -> Position: x, y - set the position of the entity + -> Size: x, y - set the size of an entity. + + renderer: draw the entity on the screen + -> src: give the path of the sprite to use + (should already be in the data of the scene) + -> rect (child): height, width, top, left - Use an offset of the + texture and not the whole texture. + -> animation: add an animation to the animation manager + of this entity + -> name: The name it is refered as + -> frame_count: the number of frame the animation has + -> frame_rate: the number of frame to show per second + -> rect (child): change the start offset/size of the texture + -> text: draw the inputed text on the screen instead of a texture + + fixed_to_cam: make the entity follow the camera + -> offset: set the position of the entity on the screen + (will be kept when the camera moves) + + parallax_component: make the texture of this entity move with it's movements + -> speed: apply a speed multiplier to the parallax. + + collision_component: provide collsisions + -> layer: select witch layer the entity collide with and wich layer may + see this entity. + + friction_giver: apply frictions to the entities that can have frictions when + theses entities are on contact with this one. + -> value: the ammount of friction to give + + friction_component: allow this entity to have friction + -> value: the ammount of friction that the air give to this entity + + movable_component: allow the entity to move or be moved + (is subject to acceleration and so on) + + controllable_component: tells that this entity may have inputs + (AI, Keyboard, Network...) + + keyboard_controller: allow this entity to be controlled by the keyboard + -> left: left moving key id + -> right: right moving key id + -> jump: jump moving key id. + PS: ids should confort with your rendering engine. + For the sfml, use sfml bindings. + + gravity_component: make this entity be subject to the gravity + -> force: the force of the gravity + + walk_action: allow this entity to walk using left and right values + of the controllable_component + -> acceleration: the acceleration of the walk + -> idle_trigger: at witch speed should the iddle animation be triggered + + jump_action: allow this entity to jump using the jump value + of the controllable_component + -> acceleration: the force of the acceleration + -> step_count: the number of frame to apply the jump force + -> conterforce: the ammount of force pointed downward to apply to + the entity when the jump is canceled before the end + + live_component: allow this entity to reswpan and listen to win/kill actions + -> count: the number of lives (0 or negative for infinite) + + win_component: trigger the win event when an entity with the live_component + make contact with this entity + + kill_component: make an entity that touch this one respawn if it has + the live_component. + + timer_component: update the renderer text to the time left + and kill all entities with the live_component when the timer comes to 0. + -> time: the number of seconds for this timer. + + camerafollow_component: make the camera follow this entity + PS: if multiple entities have this component, the camera will center + arround these entities. (warning: the camera doesn't zoom for now) \ No newline at end of file diff --git a/assets/fonts/roboto.ttf b/assets/fonts/roboto.ttf new file mode 100644 index 0000000..2b6392f Binary files /dev/null and b/assets/fonts/roboto.ttf differ diff --git a/assets/musics/music.m4a b/assets/musics/music.m4a new file mode 100644 index 0000000..3d06a28 Binary files /dev/null and b/assets/musics/music.m4a differ diff --git a/assets/musics/music.ogg b/assets/musics/music.ogg new file mode 100644 index 0000000..d92661a Binary files /dev/null and b/assets/musics/music.ogg differ diff --git a/assets/sprites/bck_layer1.png b/assets/sprites/bck_layer1.png new file mode 100644 index 0000000..ba94118 Binary files /dev/null and b/assets/sprites/bck_layer1.png differ diff --git a/assets/sprites/bck_layer2.png b/assets/sprites/bck_layer2.png new file mode 100644 index 0000000..795d9b0 Binary files /dev/null and b/assets/sprites/bck_layer2.png differ diff --git a/assets/sprites/bck_layer3.png b/assets/sprites/bck_layer3.png new file mode 100644 index 0000000..f014539 Binary files /dev/null and b/assets/sprites/bck_layer3.png differ diff --git a/assets/sprites/bck_layer4.png b/assets/sprites/bck_layer4.png new file mode 100644 index 0000000..9eed2cf Binary files /dev/null and b/assets/sprites/bck_layer4.png differ diff --git a/assets/sprites/grass.png b/assets/sprites/grass.png new file mode 100644 index 0000000..9aea4fc Binary files /dev/null and b/assets/sprites/grass.png differ diff --git a/assets/sprites/player_sheet.png b/assets/sprites/player_sheet.png new file mode 100644 index 0000000..31fe388 Binary files /dev/null and b/assets/sprites/player_sheet.png differ diff --git a/lib/gamacon b/lib/gamacon index f005983..9b2b6cb 160000 --- a/lib/gamacon +++ b/lib/gamacon @@ -1 +1 @@ -Subproject commit f00598324b1cd43ffe7f0c1eb16e31912f4469d5 +Subproject commit 9b2b6cb8e747be0321cb947bc0e2702e92529b91 diff --git a/lib/my/src/formaters/string_formater.c b/lib/my/src/formaters/string_formater.c index 91bf943..a0c531c 100644 --- a/lib/my/src/formaters/string_formater.c +++ b/lib/my/src/formaters/string_formater.c @@ -15,6 +15,10 @@ int string_formater(va_list ap, char mod[MODIFIERS_SIZE]) char *var = va_arg(ap, char *); int length; + if (var == NULL) { + write(1, "(null)", 7); + return 7; + } if (contains('0', mod)) length = my_getnbr(&mod[last_mod(mod)]); else diff --git a/lib/xmlparser b/lib/xmlparser index e060848..f923c6d 160000 --- a/lib/xmlparser +++ b/lib/xmlparser @@ -1 +1 @@ -Subproject commit e060848bef2a5781e09c3bd108c9e27e9d01b498 +Subproject commit f923c6d56c38f7604cf6ba5244b9853ebee7a781