"Questions that don't deserve their own thread" thread

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Locked
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

bartbes wrote:
Ortimh wrote:I believe it is because of WinRAR
Kind of, but mostly because you tell it to create a rar file, and not a zip file.
This seems like the likely case actually. I remember that when I try and make a .7z then make it a .love. It wouldn't work. So make it a .zip rather than a .rar (at this point we'll assume this is the problem.). I'd try myself, but I don't like winrar, and I'm too tired to download and try it.
ELFUERTE wrote:Hm,quick question. Since moving the character tile by tile looks a bit choppy,would you suggest moving the character pixel per pixel? Is this a viable alternative?
You can definitively implement this. A couple ways is some simple trigonometry. Using some nice tan's and a couple x, y coords. Then an update function, and you could have the player move from one point, to another point. This is a smooth way to move the player, however I think you would have to make changes to your moveto function (I think that's what it's called.). Or you could do tweening, if that's your thing. To be honest when I tried to look up tweening, I couldn't find much. But you could use kikito's tweening thing. I think I might personally browse his code to see how it works. But you can use tweening to move between two coords.

However, I really need to sleep right now, and I hope something out of the paragraph was readable sorry if it isn't. So I'm going to go to bed, and if you haven't gotten help by "tomorrow" (It's 5:30 am for me, and I sleep during the day.) than I'll help you out there.
Morzan
Prole
Posts: 4
Joined: Wed May 14, 2014 10:51 pm

Re: "Questions that don't deserve their own thread" thread

Post by Morzan »

Hey all!

Can löve encode images, text or files with base64? I know that it can decode it, but can it encode too? That would be awesome.

Thanks!
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by bartbes »

I don't think so. It's fairly easy to write an encoder for it, especially with luajit's bitop module.
Bya
Prole
Posts: 20
Joined: Sat Sep 06, 2014 4:24 am

Re: "Questions that don't deserve their own thread" thread

Post by Bya »

I'm trying to make a "hitbox" for my character's attack (making a platformer). I want the hitbox object to "follow" the player and be "bound" to it, but I'm not entirely sure how to do that. My player is coded as follows

Code: Select all

player = {}
	player.b = love.physics.newBody(world, 400, 200, "dynamic")
	player.b:setMass(10)
	player.s = love.physics.newRectangleShape(32,54)
	player.f = love.physics.newFixture(player.b, player.s)
	player.f:setRestitution(0.4)
	player.f:setUserData("Knight")
	player.x = 50;
	player.y = 50;
I attempted to code the hitbox similarly like a rectangle object, such as

Code: Select all

swordhitbox = {}
		swordhitbox.b = love.physics.newBody(world, player.b, player.s, "static")
		swordhitbox.s = love.physics.newRectangleShape(25,25)
		swordhitbox.f = love.physics.newFixture(swordhitbox.b, swordhitbox.s)
		swordhitbox.f:setUserData("swordhitbox")
But it doesn't work, likely because I tried substituting player.b and player.s for the x and y coordinates. I figured that by putting in what (I assume to be) the x and y coordinates for the player, that the hitbox would always follow the player. Additionally, how would I make it so that this hitbox only exists when a key is pressed down?
Morzan
Prole
Posts: 4
Joined: Wed May 14, 2014 10:51 pm

Re: "Questions that don't deserve their own thread" thread

Post by Morzan »

bartbes wrote:I don't think so. It's fairly easy to write an encoder for it, especially with luajit's bitop module.
So i should make a lua file that'll encode any file with base64 and then return the encoded data?
I would do that, but i never used LuaJIT. If you can give me any help about this i would really appreciate that! Thanks!

Edit: Nevermind, i found this: https://gist.github.com/bortels/1436940
User avatar
megalukes
Citizen
Posts: 94
Joined: Fri Jun 27, 2014 11:29 pm
Location: Brazil

Re: "Questions that don't deserve their own thread" thread

Post by megalukes »

Is it just me or this library in the Love Wiki is not working anymore? I'm looking for a serialization library, which one do you guys recommend?
User avatar
slime
Solid Snayke
Posts: 3159
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by slime »

I've heard Ser does the job pretty well.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Anyone know how in shaders to create an array with as many indices as an int that you pass it.

kinda like...

Code: Select all

extern number lightNum; //let's just pretend that it was passed a 5.

extern vec3[lightNum] lights;

yaddayaddayadda
User avatar
slime
Solid Snayke
Posts: 3159
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by slime »

You can't have dynamically sized arrays in GLSL like that, but you can do something like this:

Code: Select all

#define MAX_LIGHTS 10

extern int numLights;
extern vec3 lights[MAX_LIGHTS];

vec4 effect(vec4 vcolor, Image tex, vec2 texcoords, vec2 pixcoords)
{
    for (int i = 0; i < numLights; i++)
    {
        // etc.
    }

    // ...
}

Code: Select all

shader:sendInt("numLights", 5)
shader:send("lights", {x,y,z}, {x,y,z}, {x,y,z}, {x,y,z}, {x,y,z})
However, keep in mind loops (and other sorts of conditional things, like if-statements) can have a very large impact on performance, especially on older hardware.
User avatar
Dr.Tyler O.
Citizen
Posts: 58
Joined: Tue Jul 29, 2014 9:17 am
Location: United States

Re: "Questions that don't deserve their own thread" thread

Post by Dr.Tyler O. »

Is it possible to use Fixture:setFilterData() while still letting those fixtures produce collision callbacks? I'm aware that it sounds silly but the collision callbacks are what I'm using to detect whether the players in my video game touch items. I just don't want the items to slow the player down with collisions.
Any topic I have ever posted that I felt did not require a .love file, although they were requested, never required one so I would appreciate if you did not ask me to supply one unless you think that I am ignorant for not doing so.
Locked

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], ncrecc and 1 guest