Skip to main content
6 votes
Accepted

var=time() vs time()=var pico8/lua

In math, the = sign represents the equality comparison operator, an assertion that "the thing on the left has the same value as the thing on the right." This operator is commutative: you can exchange ...
DMGregory's user avatar
  • 141k
6 votes
Accepted

How do I get the player's position in Roblox Studio?

I feel your pain. Roblox is very confusing, despite their claims that it is an easy way to learn scripting. To get a player's position (server side) you need to access the player's character ...
Derrick Bouchard's user avatar
5 votes
Accepted

Love2D game and editor in two separate programs

Alright, found it ! I had to add this to the main.lua file in the editor folder and it worked : package.path = package.path .. ";../?.lua" require "core.engine"
Antoine Thiry's user avatar
4 votes

How can I correct an unwanted fisheye effect when drawing a scene with raycasting?

It looks like you're firing out your rays at evenly spaced angular intervals. ...
DMGregory's user avatar
  • 141k
4 votes
Accepted

How to properly split damage against armor?

If I've understood correctly, I'd do this as a two step process... Calculate how much the armor absorbs, then apply the rest to the player. Something like: ...
Basic's user avatar
  • 1,287
4 votes

Handling status/effects on a turn based RPG game

My suggestion is to not overcomplicate things. I would just use flags to indicate that an entity has these effects and then apply their effects during events, e.g.: ...
Applekini's user avatar
  • 8,543
3 votes

Create a game start-up menu screen with Lua/love 2d

There isn't a built-in menu system for love2d. The developers take a 'do-it-yourself' approach to a lot of such things. Here's an example of how I ended up rigging my menu for my first time: ...
M. Angler's user avatar
3 votes
Accepted

Implementation details of Command Pattern in conjunction with Entity Component System

How do I populate the execute command if there isn't any logic that "belongs" to an entity? But there is a mechanism for applying logic to an entity: Systems. In ECS, Systems map behavior to ...
Mattia's user avatar
  • 408
3 votes

Any advantage of having chunks with sizes by the power of two?

The main advantage of power-of-two sizes is that division by a power of 2 (on an integer) is just a bit shift, and modding is just a mask. Both of these operations are blazingly fast to do on gobs of ...
DMGregory's user avatar
  • 141k
3 votes

Optimizing falling sand simulation

This is how I parallelized falling sand: The screen is divided into cells, 1 per pixel The first kernel computes the direction each sand cell wants to go. Let's call this "push". The second ...
huseyin tugrul buyukisik's user avatar
3 votes
Accepted

How to fix diagonal velocity being greater than axis-aligned?

Is there a fix for this so no matter what of the 8 I travel its the same speed? Yes... You want to apply a total force and split it between x and y To do this for any angle, you apply ...
Basic's user avatar
  • 1,287
3 votes

How to fix diagonal velocity being greater than axis-aligned?

You use trigonometry. Here we can just use the Pythagorean theorem: a² + b² = c² If the player is moving at a 45° angle, a and <...
Kevin's user avatar
  • 6,976
3 votes
Accepted

What does the phrase "Kinematic bodies do not collide with other kinematic or static bodies" mean?

Charanor's answer to your previous question already covered this point https://gamedev.stackexchange.com/a/212552/174134 However for clarity in the video (you cited above): Dynamic - Green Kinematic -...
DavidT's user avatar
  • 853
2 votes

AABB test does not consistently detect edge-to-edge contact when bounds are very different in size

This sounds like floating point precision error when testing for exact equality. Let's model this in decimal to make it easier to read. Let's say we're using a decimal floating point format with room ...
DMGregory's user avatar
  • 141k
2 votes

How to make the player unable to change some of the game elements?

You can use cryptography. But doing that in a way that actually prevents people from creating spells requires that you do not ship the private key to users, which implies either an internet server, or ...
Ryan1729's user avatar
  • 744
2 votes

Rotate relative to set point in a specified direction in a 3D space

First of all, game engines and math go hand in hand so understanding the underlying theory should be high in your priority list. I will try to explain this at a high level, based on what I understood ...
PentaKon's user avatar
  • 358
2 votes
Accepted

Drawing rectangle with line's causes join artifact with the graphics api

You are drawing independent and unconnected lines. What you probably want is a polyline. You can get a polyline by passing in more than two points to the line ...
medecau's user avatar
  • 36
2 votes

for loop problem

Looks like this code runs after voting on a game mode. That probably means it doesn't run again until the match is over. My guess is that ...
idbrii's user avatar
  • 1,088
2 votes

How to deal with rapid acceleration/deceleration from physics forces?

in case anyone's curious, I think I figured it out. I calculated a "terminal velocity" for a given engineForce, that is the speed where drag and the engine would balance out (in this case ...
Adam L.'s user avatar
  • 41
2 votes

moving an object around a Circle

This is a pretty conventional application of a transformation matrix. First, we need a matrix that translates the center of the gear to the origin: $$\mathbb{T} = \begin{bmatrix} 1 & 0 & -C_x\\...
DMGregory's user avatar
  • 141k
2 votes
Accepted

Why check the ball and brick collision twice?

The double check aspect of the code is discussed at this point in the video. The first check lets you know that some sort of collision occurred. However, in order to bounce the ball correctly, you ...
Pikalek's user avatar
  • 13.4k
2 votes

In my Roblox Tycoon game, my button is not working

Let's look at line 42: if purchasedItems:WaitForChild(v.Dependency.Value) then And next let's look at the documentation for Instance:WaitForChild(): This function ...
Pikalek's user avatar
  • 13.4k
2 votes

How to express parabolic motion using delta time?

Disclaimer: You asked many different questions at once, which made your post too broad. Since this site is about making games, and parabolic motion in games is "objects falling due to gravity&...
liggiorgio's user avatar
  • 5,534
1 vote

How to make the character dash forward in Roblox?

To answer your question would require a tutorial-length post. So many things come into play including Filtering Enabled settings. However, I can answer "How to make the character dash forward in ...
Derrick Bouchard's user avatar
1 vote

How to make the character dash forward in Roblox?

It sounds like you're looking for BodyForce. A good place to start on how it works might be the code in this video showing a simple script for a jump pad. The ...
Anko's user avatar
  • 13.5k
1 vote

Command Shell text adventure - input methods for scrolling through text (lua)

This is not a super complete answer, but here goes: When you expect your player to hit any key to continue, the classic way to tell them is end the prompt with "Hit any key to continue". Now to get ...
Vaillancourt's user avatar
  • 16.4k
1 vote

how to display current time as a static value in lua/pico8

You are doing it correctly by setting time() at a certain point as your own static variable. Things you should know: time() can ...
Jay A. Little's user avatar
1 vote

Why is the button's code not running?

Taking a look at your script, we see that there is a little hick-up at the bottom of your function. ...
Vaillancourt's user avatar
  • 16.4k
1 vote
Accepted

How to make object that moves with constant speed not overshoot the object it collides with?

At the moment you are checking for a collision between where the player is now and the goal square. Instead, you can define a rectangle which goes from where the player was last frame and where he is ...
ScienceSnake's user avatar

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