Questions tagged [lua]

Lua is a powerful, fast, lightweight, embeddable scripting language. Lua is widely used as a scripting language by game programmers, perhaps owing to how easy it is to embed, its fast execution, and its short learning curve.

Filter by
Sorted by
Tagged with
1 vote
1 answer
57 views

cyclic dependency error in roblox survival game

Description In my game, I have have 3 module files: "PlayerList.lua", "PlayerData.lua" and "WorldData.lua". PlayerList.lua = a list of PlayerData classes (requires ...
  • 11
0 votes
0 answers
23 views

Compass bar icons don't appear where expected

I try to recreate the compass from Skyrim in Roblox and I stumbled upon a problem regarding quest icons. I have already programmed the directions of the world and now I struggle to program quest ...
0 votes
0 answers
20 views

What's the most basic way to create and handle multiple objects?

I'm trying to figure out what the most basic approach would be to effectively (or at least more effectively than what I have) create and manage objects. I know I could store them in a table when I ...
0 votes
0 answers
34 views

How to make enterable buildings share an interior?

I'm trying to make a system for enterable buildings (which is somewhat inspired by Yakuza 0) and the code I currently have works, however, one flaw I noticed is there's no way to make buildings share ...
0 votes
2 answers
72 views

Numbering sprites in a sprite sheet left-to-right, top-to-bottom

I'm using this program called Quadtastic which is a sprite sheet management tool that lets you define quads on a sprite sheet, name them, etc, and export to metadata with those names (+ position, size,...
  • 1,029
0 votes
2 answers
118 views

How to add a save/load game function to a Lua/C++ game engine

I'm curious what the best approach would be to save the current state of my game. The lua scripts contain the gamestate, but also some gameplay related info that doesn't need to be stored as part of a ...
  • 115
0 votes
0 answers
25 views

Roblox Studio: Issues with spinning platforms

I used a CFrame script to make a spinning platform for an obstacle course, but when I step on it, it sometimes flies off. What constraint should I use to keep it held together while allowing it to ...
0 votes
1 answer
118 views

Rotating an object in a circular path (using time)

I want to move an object in a circular path but I want it to complete its movement in that circle when the time ends. I tried doing this: ...
0 votes
0 answers
47 views

Remove tool from player

I have just started learning Roblox scripting and I've added a part which will add a rocket launcher to the player's backpack when they run over it. The player should then be able to fire a single ...
  • 153
2 votes
1 answer
67 views

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

I'm working on a game in LOVE2D using Lua, where you pilot a drilling vehicle. The idea is that as you drill into different surfaces, you speed up/slow down depending on how dense that surface is. I'...
  • 41
0 votes
0 answers
29 views

Applying quadratics to velocity based player movement

In a speed based system where player.x and player.y +=1 when a button is pressed, a 3pt quadratic can be calculated via ...
  • 207
2 votes
1 answer
76 views

How do I get the consistent time it would take for two points to reach each other in circular motion?

I'm making a 2D game. It involves the player swinging around a grapple hook in perfect circular motion, however, I want to make the cooldown for this ability based on predicted end position for the ...
1 vote
1 answer
73 views

Find the smallest angle to turn between two angles in range 0..1

I have a function for approaching a value to a target by a certain amount: ...
  • 237
0 votes
1 answer
56 views

for loop problem

So it works first time when the player dies. But when it dies twice the for loop doesn't work. ...
  • 1
0 votes
1 answer
32 views

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

how can I join lines to draw rectangles, I get this artifact like this, here's my code: ...
  • 237
0 votes
1 answer
126 views

Using Lua to define NPC behaviour

I'm working on a RPG in C using Lua for event scripting like NPC behavior. I ran into a design problem. I have created Lua threads in the C API for each game object which can be a NPC. So this: ...
1 vote
0 answers
90 views

How to get started in game development with Lua without LOVE or any game engine [closed]

Recently, I've been wanting to get into Lua, and I just started to. I was wondering if it is possible to make a game, without the LOVE engine, like are there any built-in libraries I can use or ...
0 votes
1 answer
69 views

How can I allow my players to create, save and use moves?

I want to create a system to allow the players to create, save then use moves in Roblox Studio. My first thought was to do this by letting them create animation files in Roblox Studio, but I'm not ...
0 votes
1 answer
87 views

Pathfinder is making my NPC follow my oldest position only

I am trying to make a maze/horror game. I used an online template in the Roblox library as my enemy. I used pathfinder as you will see in the code below. It's finding me like it's supposed to, except ...
0 votes
1 answer
491 views

Play and Pause State

Problem i want to implement a pause state and with a simple conditional inside the update of PlayState is very very simple. However i think that the pause has to be another state in the StateMachine ...
2 votes
3 answers
778 views

2d diagonally velocity greater than straight-line velocity. How to fix?

If I have a topdown rpg type game. And movement in 8 directions (N/E/S/W/NE/NW/SE/SW) in a 2d game that involves both x and y velocity. I'm finding when i'm moving in the diagonal directions i'm ...
  • 207
0 votes
1 answer
115 views

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

I know there's a geometry formula to calculate the next point in rotation relative to another point in 2D but I'm working in 3D and I want to calculate the next position in specified direction as well....
1 vote
0 answers
70 views

Binding Lua Function to Perform tasks using std::async

I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would ...
  • 11
1 vote
1 answer
254 views

How to connect a GUI button to function?

I am developing a new Roblox game where you can setup and control you're own virtual machine using SurfaceGUIs on a modeled screen. I am trying to make a confirmation GUI where if you click YES, then ...
1 vote
0 answers
1k views

Optimizing falling sand simulation

So, for the past couple of weeks, I've been working on a falling sand simulation inspired by games such as The Powder Toy, Noita, and Sandspiel. I've been making it in Love2D and I'm please with what ...
  • 1,029
0 votes
1 answer
120 views

When PlayerRemoving event is fired, for loop does not work properly

while I was implementing the Backback save feature in my Roblox Game (using game.Players.PlayerRemoving:Connect(), I found that when I used a loop of any form (<...
0 votes
0 answers
925 views

Hiding World of Warcraft UI Elements with Lua

I'm tyring to make a very simple WoW addon that hides the gryphons on either side of the main menu bar and hides the micro buttons in the lower right. The addon has one Lua script, main.lua: ...
  • 101
0 votes
0 answers
198 views

Integrating Moonsharp with Unity for Nintendo Switch project

Has anyone tried to run Unity project with integrated Moonsharp on Nintendo Switch? Can it be done? Are there any significant performance issues due to running Lua scripts? EDIT: Sorry, I wasn't ...
0 votes
0 answers
66 views

Facing issues trying to Parse JSON in Lua

Problem statement: Need help trying to load a JSON file into a table array in Lua for Corona SDK development. My Objective: Call specific data from JSON file to my application by using key value ...
0 votes
1 answer
158 views

How is tile offsetting accomplished in 2d side scrollers?

The idea is to work with tiles that together make up a larger image, or world so to speak. but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw ...
3 votes
1 answer
105 views

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

I am making a text turn based RPG fighting game in which you create your own spells. You also share them as JSON files with your friends. Sharing is required to win. The game is designed so that it ...
0 votes
2 answers
2k views

How to make the character dash forward in Roblox?

In my game, I want to make a skill in a tool to dash forward for a specific range and if the character came in contact with a humanoid during the dash, it stops right on contact and stops the other ...
  • 11
0 votes
1 answer
85 views

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

I'm writing a simple text-based adventure in lua. The intent is the user clicks on the game.exe and it loads up the command prompt or whatever command shell they have and they play the game there. ...
  • 207
2 votes
2 answers
487 views

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

Pico8 has a function time() that when called displays the current time from start of program. i.e. print(time(),0,0,14) --prints time at (0,0) with colour 14 However the function doesn't stop and ...
  • 207
0 votes
1 answer
33 views

Why is the button's code not running?

My script for a slot machine isn't working. When the button in the Bilboard GUI is clicked, the below dosen't run. I am new to scripting and this is mostly based on wiki/stack exchange/ Dev page info. ...
  • 1
1 vote
2 answers
68 views

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

time() is a preset function in pico8 gameengine. I don't understand whatsoever why I get an error when I write: time() = var But it's fine if I write (where var is any variable) var = time() What ...
  • 207
2 votes
2 answers
15k views

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

In Roblox Studio, I have this code in a script file: ...
2 votes
1 answer
123 views

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

To learn LOVE2D I am creating a simple project. Player moves the square with arrows keys until it hits the goal square, at which point the game is won. ...
0 votes
2 answers
533 views

How to implement this XP formula?

I found this response but the thread is closed: https://gamedev.stackexchange.com/a/13639 level = constant * sqrt(XP) I seem unable to properly get current level, this is how I tried to do it, and ...
0 votes
2 answers
157 views

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

With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now ...
  • 101
0 votes
1 answer
219 views

Roblox, custom chat filter

So, I would like to add my own chat filter to my game, how would I do this? eg: Player says: "DIE" Goes through chat filter and comes out as: "###" or any other string I specify.
1 vote
0 answers
39 views

How to aim bullets at a player in Vavio

In Vavio, how do you make an enemy aim at the player then shoot a bullet? Here's the code I tried: LevelSpawnData/spawnData-L0.json ...
  • 123
1 vote
1 answer
265 views

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

My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size ...
0 votes
1 answer
313 views

Walking around a sphere in Lumberyard

I am trying to create a simple game using Amazon Lumberyard and my goal is to have levels/stages where the player will be able to walk around a mini planet. I have seen a lot of tutorials about this ...
0 votes
1 answer
148 views

What am I missing for this flycam to work correctly?

Through reverse engineering, I've found an instruction to inject on which allows me to obtain the XYZ coordinates of the camera, as well as pitch and yaw. Thus, I have the following: camX (Plane)...
  • 141
0 votes
0 answers
195 views

How can I load a script once in LuaJit/Lua and use it across multiple VMs in different threads?

So, I came across an interesting problem. I'm implementing some threaded game logic, and one of the things I decided to do was to use Multiple Lua VMs, with each worker thread containing its own VM. ...
0 votes
0 answers
228 views

binding glm operators with luabridge

I am attempting to expose glm vector functions/data to luabridge like so: ...
  • 2,579
1 vote
2 answers
4k views

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

Hello I have a game using raycasting for the TI Nspire in Lua, and when the player faces a wall so that their degree they are facing is perpendicular to the length of the wall, I am having what is ...
0 votes
1 answer
2k views

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

I just got started programming games and decided to try out love2d since I'm learning lua. I was wondering if anyone knows how I can create just a simple 2-3 button menu when you start up the game. ...
6 votes
1 answer
538 views

Love2D game and editor in two separate programs

I'm building an engine in Love2D and I need to build an editor who will create scenes with game objects I wrote in lua. The thing is that there's this guy in my team who said : "Don't include the ...

1
2 3 4 5