Try putting google-play-services_lib right outside of the love_android folder.Kibita wrote:I didn't get the part where I must update my android project for add ad support:What I did was copy the google-play-services_lib folder into the love_android folder and use the command line, it worked, but when I do a ant debug it shows BUILD FAILED "/../google-play-services_lib resolve to path with no project file for project directory to my love_android project"Adding google-play-services_lib without an IDE
For adding google-play-services_lib to your project you will first need to download it from the android-sdk by going to the "Android Sdk Manager" on "extras" and checking on "Google Play Services" then you can find the library folder on android_sdk/extras/google/google_play_services/libproject/google-play-services_lib. Now you have to paste it next to the project folder and execute "android update project -p 'dir/to/google-play-services_lib' " and you're done!
What should I do?
"Questions that don't deserve their own thread" thread
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: "Questions that don't deserve their own thread" thread
Re: "Questions that don't deserve their own thread" thread
Whether you put it before or after love.load doesn't matter. It should be inside love.load for it to work.XxHAMADEHxX wrote:<snip>Code: Select all
<snip> function love.load() end
Strange I did put love.math.random after love.load() and I still have to set a seed. Sorry for the caps I just put it so that it is easier to see.
Maybe this helps you understanding. After conf.lua and the modules are loaded, LÖVE does this:
- Load and execute main.lua.
- Call love.run.
The default love.run in turn does the following:
- Initialize the random seed.
- Call love.load if defined.
- Initialize a couple more things and start the main loop (processing events and calling update / draw in succession).
So, unless you put the code inside love.load, the seed won't be initialized. Whether you put it before or after defining love.load is irrelevant; the important part is that it's executed after setting the seed, and for that purpose putting it inside love.load is ideal.
(I think S0lll0s meant love.load rather than love.run)
-
- Prole
- Posts: 9
- Joined: Thu Jun 25, 2015 11:33 pm
Re: "Questions that don't deserve their own thread" thread
Thanks for the reply! I'm working on a crafting system to check if ingredients match a recipe. Just been trying out the logic so far using strings (and sorting the tables before comparing), but I may eventually create some sort of inventory objects instead and your suggestion for the N level search will probably be very helpful with that!Skeiks wrote:Snowbadger wrote:Edit: Nevermind on that one. I finally figured out a fix.
Another question, though: If I were to compare arrays of strings, would there be a more efficient way than concatenating both arrays and comparing those resulting strings?
For example, if I had something like this to populate an empty array with user input in order to compare it with an existing array.Code: Select all
array = { "apple", "banana", "pear" } userArray = {} -- extra code here to insert user input into userArray string1 = table.concat(array, " ") string2 = table.concat(userArray, " ") if string1 == string2 then -- do something
Maybe concatenating the arrays wouldn't work 100% since tables could be in different orders. I dunno if concat handles sorting. If the strings are always going to be the same though I think that's actually a pretty efficient way of handling it.
It really depends on what you're comparing the tables for though. In some instances you may just have to do a 1 to 1 n^2 compare. In other instances, if you know the keys of a table, and the keys are irrelevant, set the keys to equal the string value and you could just look for keys. That way you could do N level search. Let's say you have a table array = {banana = "banana", apple = "apple", pear = "pear"}. You could do:
This won't work if you need the keys to have information about the data they contain, but it is a pretty fast way to handle comparing tables I think. Maybe someone else could give a more complete answer.Code: Select all
match = true array = {banana = "banana", apple = "apple", pear = "pear"} userArray = {} foreach key, value in userArray do if array[key] then continue; end match = false; break; end
Re: "Questions that don't deserve their own thread" thread
Very quick question:
Can someone explain to me why the code in this "if" is executed?
data[2] is equal to "position", but data[1] IS equal to id.
though I would like it not to execute only if data[1] is different than id...
https://i.gyazo.com/0b1581b3d1a54d45fcb ... 292c79.png
Thanks!
Can someone explain to me why the code in this "if" is executed?
data[2] is equal to "position", but data[1] IS equal to id.
though I would like it not to execute only if data[1] is different than id...
https://i.gyazo.com/0b1581b3d1a54d45fcb ... 292c79.png
Thanks!
Don't panic and never forget your towel.
Re: "Questions that don't deserve their own thread" thread
Hard to say without access to debugging your program. A possible explanation is that they look equal but they aren't (e.g. if they are strings, one may have a space at the end, or if they are numbers with decimals, they may differ on a non-visible decimal). This works as expected for me (prints "condition false"):
Please paste the code inline rather than linking to an image next time.
Code: Select all
local id = "abc"
local data = {"abc", "position"}
if data[2] == "position" and data[1] ~= id then
print("condition true")
else
print("condition false")
end
Re: "Questions that don't deserve their own thread" thread
Thank you! Yes, I was actually comparing a string with a number :S
I will paste my code next time so it is more clear!
I will paste my code next time so it is more clear!
Don't panic and never forget your towel.
Re: "Questions that don't deserve their own thread" thread
Im using the android port of löve, and i have a problem with at least debugging simple things by touching the screen. i literally copied and pasted this onto main.lua:
function love.draw()
local touches = love.touch.getTouches()
for i, id in ipairs(touches) do
local x, y = love.touch.getPosition(id)
love.graphics.circle("fill", x, y, 20)
end
end
.. and i keep getting:
Error
Syntax error: main.lua:41: '=' expected near 'for'
reply me if u want the tracebacks, kinda tired to write em today.
I am new to löve but has an idea how to use any lua. trust me, i have made a windows screensaver like thingy but instead of the logo bouncing around, its a mario.
function love.draw()
local touches = love.touch.getTouches()
for i, id in ipairs(touches) do
local x, y = love.touch.getPosition(id)
love.graphics.circle("fill", x, y, 20)
end
end
.. and i keep getting:
Error
Syntax error: main.lua:41: '=' expected near 'for'
reply me if u want the tracebacks, kinda tired to write em today.
I am new to löve but has an idea how to use any lua. trust me, i have made a windows screensaver like thingy but instead of the logo bouncing around, its a mario.
i love dinosaurs
Re: "Questions that don't deserve their own thread" thread
I'll put this here as i'm pretty sure the solution is quite simple, however i am having sever issues of brain fog right now and can't seem to figure this out. Basically, how can i find the mouse position relative to a canvas internal coordinates?
This should show the issue: The most relevant part is probably in the collision check:
Basically, the grid is drawn to a canvas (which might be moved about) so the cursor collision is all over the place.
This should show the issue: The most relevant part is probably in the collision check:
Code: Select all
if collision:check(love.mouse.getX(),love.mouse.getY(),0,0, tile.x,tile.y,tile.w,tile.h ) then
love.graphics.setColor(200,190,180,255)
else
love.graphics.setColor(100,100,100,255)
end
Re: "Questions that don't deserve their own thread" thread
It worked! Thank you!master both wrote:Kibita wrote:I didn't get the part where I must update my android project for add ad support:
Try putting google-play-services_lib right outside of the love_android folder.
Another question: when will love2d-android support the leaderboard from Google Play?
Re: "Questions that don't deserve their own thread" thread
How do I set an angle to an object? Basically I have a rectangle that, when the game starts, I want to make move in a random direction, how would I accomplish this?
Who is online
Users browsing this forum: Google [Bot] and 13 guests