Giter Site home page Giter Site logo

raspurrin / so_long Goto Github PK

View Code? Open in Web Editor NEW
34.0 1.0 2.0 70.57 MB

A platformer with gravity, jumping, audio and two types of enemies!

License: GNU General Public License v3.0

Makefile 1.96% C 92.71% Objective-C 5.32%
graphical platformer 42-cursus 42-school 42wolfsburg so-long mlx42 game-development mlx

so_long's Introduction

image So_long

Index:

Description

My game was made in C with the graphical library MLX42

The goal of the game is to collect all pickups and go through the exit and... Not get killed in the process. Usually this project is made with a top-down view, but I decided to make it a platformer instead! It runs on Mac, Linux, and for Windows only the mandatory part works. If there are any issues with running it, refer to MLX42 for guidance.

Bonus features

  • Smooth animations.
  • Gravity.
  • Sound effects and background music.
  • The ability to jump.
  • Two types of enemies which spawn in random locations and have random movement:
    • Ghosts, flying enemies.
    • Pink monsters, ground enemies.
  • Lives with a cooldown period upon getting hit and a red filter to indicate that.
  • Movement counter and lives counter on the screen.
  • Ability to kill enemies by jumping on them.
  • An ending message with a game over or winning screen at the end.
Screen.Recording.2022-06-09.at.3.20.04.AM.mov

The main character has a different animation for moving and standing still. And also switches between a reversed spritesheet when going in a different direction:

animation.mov

How to compile and run the game

You could clone the project with git clone --recurse-submodules <git url>, but even without the submodules will be initialised and updated automatically.

To run only the mandatory part of the game use make and to include the bonus use make bonus

If you are on Linux and simply typing make doesn't work, that means don't have all required libraries. Use this command to install them:

  make install on linux

And then run the game by typing:

  ./so_long input/large_map.ber

Input maps:

It can take different maps as input to generate different levels, provided it passes all requirements. I provided valid and some invalid maps in the input folder. You can make your own maps provided they are rectangular, use the .ber extension, are fully enclosed by walls, include only one P, contains at least one C and E character. 0 = empty space, E = exit, P = player starting location, 1 = wall or platform, C = collectible

Changing game settings:

In the header in the includes folder you can change macros to change the game, like how many lives you have, the amount of enemies, to toggle gravity, damage, change the jump modifiers and so on. Make sure to recompile everything by using make re to apply the changes.

Future additions

For now I want to focus on my other projects but at some point I want to improve this game a little:

  • Make certain it runs on different platforms.
  • Clean up my code. If you have any suggestions for this, don't hesistate to tell me, I would love to hear feedback!
  • Fix the collision.
  • Make the background and ending messages dynamic and scalable.
  • Timer with decreasing visibility.
  • Create a menu where you can change the game settings and a pause option.
  • Make different levels.
  • A scoreboard.
  • A blog post/tutorial about the project, which will cover both implementation for Minilibx and MLX42.

so_long's People

Contributors

c8p2d01 avatar raspurrin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

alaex

so_long's Issues

Get textures to work corresponding with the map.

Determine size of blocks beforehand, make sure the image sizes are appropiate for it. And then with the data of the amount of blocks in one line and the amount of lines you can determine the size of the window and with this information also the position of each image.

First initialise each different texture.
Then iterate through the map and depending on the character encountered, add an instance of that texture as an image to the window.

Fix textures

The walls need to be slightly higher and the door has some white around it that needs to go away.

Error handling

So if I handle errors with some of the mlx functions, image_to_window seems to return false even though the functions work fine O_o

Introduce movement with the WASD keys.

First get the position of the character by
using the block_size * amount of blocks in the map and block_size * amount of lines.

Then keep this information in a struct and keep updating it with every movement. Movement works with a general hook and if statement based on the key pressed, which will then adjust the value of the instance of the image you are using.

Leave a blank map space where the character has been or perhaps do it differently, idk yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.