Gotten interested in .lua and love 2D

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
SuperScourge
Prole
Posts: 14
Joined: Tue Apr 16, 2013 8:38 am

Gotten interested in .lua and love 2D

Post by SuperScourge » Fri Nov 22, 2013 3:22 pm

Since I played Mari0 the Portal/SMB1 crossover I've gotten so into that I was gonna take the time to learn using .lua and create games, so how I can start by taking the time to learn such code? There's no books in the ibooks store (I like to read it digitally more so I can highlight a section and note it or whatever).

So how I can learn using .lua and Love2D? now my biggest feat I would love to try is a 2.5D shooter which I'll need to learn how to make that, is it really possbile to make a 2.5D Shooter like Duke Nukem 3D with mouse aim?

so I'm basically new to using love 2D and .lua and I have BBedit to do all of my .lua language coding.

User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: Gotten interested in .lua and love 2D

Post by mickeyjm » Fri Nov 22, 2013 6:10 pm

Welcome to the forums!

I recommend you start out by looking through this and the wiki to get started, also looking through other people's code can help, provided it is commented well enough :P.

Also small thing, but ".lua" is the file extension, the language is simply "Lua" and the domain is "love2d" while the framework itself is simply called "LOVE" (umlaut on O but I don't know how to type that).

Finally 2.5D is possible, but relatively tricky to do and not really the sort of thing love is geared towards.
Your screen is very zoomed in...

User avatar
SuperScourge
Prole
Posts: 14
Joined: Tue Apr 16, 2013 8:38 am

Re: Gotten interested in .lua and love 2D

Post by SuperScourge » Fri Nov 22, 2013 8:36 pm

mickeyjm wrote:Welcome to the forums!

I recommend you start out by looking through this and the wiki to get started, also looking through other people's code can help, provided it is commented well enough :P.

Also small thing, but ".lua" is the file extension, the language is simply "Lua" and the domain is "love2d" while the framework itself is simply called "LOVE" (umlaut on O but I don't know how to type that).

Finally 2.5D is possible, but relatively tricky to do and not really the sort of thing love is geared towards.
I'll look on that site when I have time, I also found a ray casting code that creates a 2.5D world and I'm gonna play around with that and see if I could find a way to create such FPS from using those codes.

viewtopic.php?f=4&t=6834 - this is a good example I could try if I wanna try making a 2.5D FPS

viewtopic.php?f=5&t=35876 - I've got most of the Ray casting codes I can try out and figure out how to get the player turn more quickly like moving Duke from his 2.5D game Duke Nukem 3D

User avatar
BozoDel
Party member
Posts: 164
Joined: Fri Nov 01, 2013 10:28 pm

Re: Gotten interested in .lua and love 2D

Post by BozoDel » Sat Nov 23, 2013 1:37 pm

Hey there, welcome!

There's some info in this thread. mickeyjm told you to check out Programming in Lua, but I have to advise against it if you're a total programming noob. Heck, it's hard even if you have some basic notions. And I think you should try very basic 2D first, as it's more natural in LÖVE.

User avatar
SuperScourge
Prole
Posts: 14
Joined: Tue Apr 16, 2013 8:38 am

Re: Gotten interested in .lua and love 2D

Post by SuperScourge » Sun Nov 24, 2013 8:17 am

BozoDel wrote:Hey there, welcome!

There's some info in this thread. mickeyjm told you to check out Programming in Lua, but I have to advise against it if you're a total programming noob. Heck, it's hard even if you have some basic notions. And I think you should try very basic 2D first, as it's more natural in LÖVE.
That can be hard There's one 2D project that's not a side scroller but a old top view 2D game from WestWood/EA's (Bought from EA and Closed) game Command & Conquer Red Alert, I've ripped out all images from the game Command & Conquer Red Alert and working on a project called Command & Conquer Platinum and tribute game based around Red Alert 1 I've made a Menu for that and still need to work on it's buttons for it so as of now it's just an image with the intro music from the game playing.

how I can insure the sprites I ripped out from the game work within' Love2D? must has a blackground that covers a certain pixel of sprites like a solider or a tank. I could upload some of these sprites to show what I've done to rip them out using MIP Viewer app that does this for Command & Conquer games.

Take this Sprite from the game it's a Chan Sprite if you look at the top of this sprite it's black in the black background how I can get Love2d to avoid this and make it like the original game as possible?

Image
The Size is small I know that's how the sprite is in this game - hopfully you can still see what I'm saying

And now the vehicle like this Tank here

Image
the size is small too but gives a clear showing of this tank in the middle it's black so how I can either tell Love2D to avoid this or I'll have to somehow rip the transparent version of the Game's Sprite to put in this project.

User avatar
BozoDel
Party member
Posts: 164
Joined: Fri Nov 01, 2013 10:28 pm

Re: Gotten interested in .lua and love 2D

Post by BozoDel » Sun Nov 24, 2013 10:01 pm

Hm, about the sprite backgrounds... yeah, I don't know why, but some games work with that, they recognize that color as transparent. Now LÖVE makes much more sense: if you want transparent, just make it transparent. So I guess you're gonna have to change all backgrounds by hand. Or maybe pasting some pics from the same object in the same image file, respecting the distance between each, and then changing the background color. I don't know any tool that could do that automatically.

User avatar
SuperScourge
Prole
Posts: 14
Joined: Tue Apr 16, 2013 8:38 am

Re: Gotten interested in .lua and love 2D

Post by SuperScourge » Wed Nov 27, 2013 7:49 pm

BozoDel wrote:Hm, about the sprite backgrounds... yeah, I don't know why, but some games work with that, they recognize that color as transparent. Now LÖVE makes much more sense: if you want transparent, just make it transparent. So I guess you're gonna have to change all backgrounds by hand. Or maybe pasting some pics from the same object in the same image file, respecting the distance between each, and then changing the background color. I don't know any tool that could do that automatically.
I've got pixen and that can work if I fire up Red Alert and goto the mission with the chan guys and take a screenshot of it and figure out the shape of his head and create edit it so it's another color to be used in my project.

I'm also working on my main menu by hand I've came up with the style of Red Alert's with a twist how I can make the button look highlited when it's selected?

Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Gotten interested in .lua and love 2D

Post by Wojak » Thu Nov 28, 2013 6:22 am

SuperScourge wrote:
Take this Sprite from the game it's a Chan Sprite if you look at the top of this sprite it's black in the black background how I can get Love2d to avoid this and make it like the original game as possible?

Image
The Size is small I know that's how the sprite is in this game - hopfully you can still see what I'm saying

And now the vehicle like this Tank here

Image
the size is small too but gives a clear showing of this tank in the middle it's black so how I can either tell Love2D to avoid this or I'll have to somehow rip the transparent version of the Game's Sprite to put in this project.
there is a little trick for that:

Code: Select all

local maketransparent = function(file)
	local imgdata = love.image.newImageData(file)
	for i=0,imgdata:getWidth()-1 do
		for j=0,imgdata:getHeight()-1 do
			local r,g,b,a = imgdata:getPixel(i,j)
			if r == 0 and g == 0 and b == 0 and a == 255 then
				imgdata:setPixel(i,j,255,255,255,0)
			end
		end
	end
	return love.graphics.newImage(imgdata)
end
the same code is used in my raycasting demo ;)

bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey » Thu Nov 28, 2013 7:06 am

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:59 am, edited 1 time in total.

User avatar
SuperScourge
Prole
Posts: 14
Joined: Tue Apr 16, 2013 8:38 am

Re: Gotten interested in .lua and love 2D

Post by SuperScourge » Thu Nov 28, 2013 4:32 pm

Wojak wrote:
SuperScourge wrote:
Take this Sprite from the game it's a Chan Sprite if you look at the top of this sprite it's black in the black background how I can get Love2d to avoid this and make it like the original game as possible?

Image
The Size is small I know that's how the sprite is in this game - hopfully you can still see what I'm saying

And now the vehicle like this Tank here

Image
the size is small too but gives a clear showing of this tank in the middle it's black so how I can either tell Love2D to avoid this or I'll have to somehow rip the transparent version of the Game's Sprite to put in this project.
there is a little trick for that:

Code: Select all

local maketransparent = function(file)
	local imgdata = love.image.newImageData(file)
	for i=0,imgdata:getWidth()-1 do
		for j=0,imgdata:getHeight()-1 do
			local r,g,b,a = imgdata:getPixel(i,j)
			if r == 0 and g == 0 and b == 0 and a == 255 then
				imgdata:setPixel(i,j,255,255,255,0)
			end
		end
	end
	return love.graphics.newImage(imgdata)
end
the same code is used in my raycasting demo ;)
I do have most versions of your Raycasting Demos and I like how you did the 2.5D now here's the thing I been studying Duke Nukem 3D (if I don't have the high-res pack on but on software rendering, I'm not sure if the pictures on the walls are separate or not when I look at it that's A 2.5D game too, I made some big sprites (or pictures) and small ones in case Love2D's image resize make it look weird.
bekey wrote:You might want to replace the black color to a very bright pink color. Change Wojak's code accordingly.

Or just use .png

Don't have a tool? Try Paint.net, Gimp or Graphics Gale. Most of these are free
Not sure if I wanna work on Command & Conquer Platinum at the time still need to study how the engine works and stuff. - I do have Photoshop CS4, Gimp, and Pixen.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests