Tag Info

Hot answers tagged

12

Since you are talking about screens, I feel it's best to separate all that logic into different Screens. What I normally do: Define an interface called screen, and have multiple screens implement it. Like LoadingScreen, MainMenuScreen, GameScreen, GameOverScreen, HighScoreScreen etc. In your game you put a variable that holds the current screen. Each loop, ...


8

Spawn the object at a random location on the side of the screen. Additionally, give it a initial direction/velocity of straight across the screen +/- random 20 degrees at whatever speed you want it to move. Finally choose a random target location on the opposite side of the screen. Now use steering to guide the object from its initial starting position and ...


7

Disclaimer: I've created the two tutorials I'm going to link here I've done two tutorials. None of them is complete, but will get you from 0 to 80% quickly. The first one is a LÖVE-centric one called love-tile-tutorial: https://github.com/kikito/love-tile-tutorial It's about 50% done. Starts with the basics, and deals with Images & Quads, as well as ...


5

however there is not an awful lot of commercial games using PyGame, and I'd like to invest my time in the best way and ideally to make an extra buck in the future. And who cares? The toolchain is not what makes a game commercial or not, it's not what makes it a AAA title or not. PyGame will not prevent you from realizing your goal of creating a ...


5

LÖVE isn't as a library that you import into Lua. What it does is embed the Lua interpreter and expose its game functionality to that interpreter. If you'd like to interactive play with the API, there's a couple of libraries built for debugging and live coding: https://love2d.org/forums/viewtopic.php?f=5&t=2473 https://github.com/vrld/love-console ...


4

You want a stencil. Stencils let you flexibly define regions that love.graphics operations won't affect. Here's an example. It does this: Draw some colourful circles. Set an inverted stencil made of two triangles. Draw a black rectangle over everything. See how the black rectangle doesn't actually cover everything? It's cut out where the triangles ...


3

I don't think those games used a realistic sound perception model. Probably the best approach is to evaluate the distance between source and hearer and distribute the probability of state change in the enemy. A gaussian distribution would be perfect but heavy; you may divide the distance in tree ranges: near (always wake), far (never wake), middle (chance ...


3

that would mean that the entity factory has to be aware of the Rendering System If your entity factory function has to create objects for/from the rendering system, the obviously your entity factory function needs to create objects for/from the rendering system. There's no avoiding that; it's a part of what you need to do. A component system is not ...


3

I don't know much about Love so I don't know if there is a built-in way, but you can change the icon of an executable file using a variety of icon editing software. Last time I did this in days of yore my weapon of choice was IconForge but I'm sure there are other tools available now (like these).


3

You can get specific information about the image clicked by accessing the ImageData associated with the Image you're drawing. Specifically the getPixel function. When you detect a click, find which image is being clicked on. Then you need to get the ImageData you created for that image. Finally, convert the click coordinates to image local coordinates and ...


3

I would strenuously urge you to give the player's ship retro-rockets to be used during braking. You really need to do that, because the alternative is for the computer to take over and automatically turn the ship to face away from its direction of travel whenever it decides that the player should stop. That'll be intensely annoying to the player, having ...


3

I want to be a game developer... now what? This is a pretty comprehensive guide to starting out in game development, covering what languages are available, then a list of the most popular tools and libraries, as well as free and commercial book suggestions. Most of what is inside is completely free and provides direct download links. However, it is a ...


2

I started using Lua and Löve a couple of weeks ago, I didn't find any good resource on getting started, I just used the wiki, it covers the very basics and then you can just use the documentation for the rest. It's not very different from any other 2D graphics API out there.


2

C++ scares me, however feel free to tell me how stupid I am You shouldn't fear c++ it is a great language. My goal is to make 2D games like Terraria, Super Meat Boy, DefCon, etc. Which language and tools should I choose to accomplish my goal? Awesome! You can do this in pygame, there's nothing wrong with that. Do you like programming in python ...


2

From the easy to the scalable and complex to implement, kind of: A fast to write option is simply to let the HUD know where the player is and let it grab what variables it needs directly. It's not very flexible, but for games where the player is well defined and the scope of the game is tightly contained it can work well enough. This is a tightly coupled ...


1

You have access to the b2ContactImpulse in the PostSolve callback on the b2ContactListener. The normalImpulses field on b2ContactImpulse holds an impulse applied to both bodies in the direction of the contact normal. An impulse is calculated as a change in velocity times the mass of the object, so the normalImpulses well describes how hard the two fixtures ...


1

The usual way to solve this is to create the objects once the physics-simulation has completed. In your collision callback you would push all the objects you want to create into a list-like data-structure. Once your physics-simulation-step is complete (eg. after world:update), create the objects/bodies that have been pushed to the list (thereby removing ...


1

When setting the origin of a scaled image, use the original dimensions of the image instead of the final scaled size. For instance to set the origin to the center of a 200x200 image, you would use 100x100 even if it is scaled as the 'add' and 'set' functionality scale those values internally. Glad I could help ;)


1

EDIT It seems I misunderstood your question; you are not asking how to switch between different callbacks, you want to have them in different files. The principle is the same: load_module = require "main_load" love.load = load_module.load I've written a scene manager to do just that. I will open source it some day but to give you an idea here's how it ...


1

If your current_state variable is a string, then this is really easy in Lua: game_states = {} function game_states.game() -- game stuff end function game_states.titlescreen() -- title screen stuff end -- then, inside the Update function: game_states[current_state]()


1

What I do is roughly as follows: I have a directed acyclic graph data structure, which is essentially just a bunch of nodes that point at each other. Each node represents a game system. e.g. the UI, the world, the input, the rendering. And each node points at other nodes that come before or after it. Once all the nodes are in place, it's easy to flatten it ...


1

To run a game you made in Löve2D, you have to drag its folder (the one containing the main.lua) to the Love2D executable. It's the easiest way to run it. If you want to export you game into an executable itself, you have to package the folder and embed it into the Love2D executable. If you made a .love file, the same applies, just drag the .love file to the ...


1

Just download Doom (or wolfenstein) source code and have a look at it. Basically it recursively walk into sectors near current player sector, check if there is monsters inside and wake them up. there is some conditions : eg : if there is a closed door between sector dont go into it (if door is closed monster is not supposed to hear you)


1

LOVE2D seems like a cool language. I'll state now that Lua's weird to me, particularly trying to get OOP down with it, since there's no real built-in easy method to do this with. In any case, Pygame (framework; based on Python), Love2D (framework; based on Lua), Game Maker (game engine with IDE), and StencylWorks (free game engine with IDE; makes Flash ...


1

The .love files are actually renamed .zip files. These zip files contain directory structures, so if your code refers to, say, "foo/bar.dat", your zip file has to have a "foo" directory with the "bar.dat" contained within. See http://love2d.org/wiki/Game_Distribution for details.



Only top voted, non community-wiki answers of a minimum length are eligible