Pi, a new game (NEED HELP :S)

Show off your games, demos and other (playable) creations.
Post Reply
Puzzelism
Prole
Posts: 16
Joined: Wed Mar 06, 2013 2:00 am

Pi, a new game (NEED HELP :S)

Post by Puzzelism »

HERES THE DEAL:

The game:
Pi is a game that me and my friends decided to make, We are in the eighth grade, so i (the only coder/scripter/lover) can understand all the mathematical functions and stuff like that. So one day i brought up the idea that my friend, who plays keyboard in band, and my other friend, who has an A++++++ in art, should make a game, because I had a basic grasp of the love2d engine. So we did, and that game is Pi. An adventure game where it is heavily bloomed and very black and white, the player would simply explore, and that would be it.

Image

The problem
right now I only have a grasp of the simple things (Everything found in the .love is made by me, except for the assets, which are temporary) And the problem is that I want a simple, fast, and easy to make jump function, to make the player able to jump and be able to have, well all the physics a platformer should have, i'm not that good a programmers, so bear with me :P

ANY HELP/INFO/CRITICISM WILL BE GREATLY APPRECIATED, THANKS! (Also, how to i put a teaser image on this page?)

DOWNLOAD!: https://www.mediafire.com/?b15vhbcvmm59o99
Last edited by Puzzelism on Fri Dec 13, 2013 2:26 am, edited 1 time in total.
One cannot simply code love.. Oh wait with LÖVE you can..
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Pi, a new game (NEED HELP :S)

Post by SiENcE »

I looked at your love file. You have two times a intro.wav included, which is 22mb big. I suggest you to only include one :) and convert it to ogg fileformat.

I get an out of memory error. It's because you put the "love.audio.play(intro_music)" function into an update function. So the play music function is called every update which is no good :). You need to place this function call outside of update or draw or in love.load() for example.

You also placed newImage loading in the draw function menu_draw(). This is also no good because everytime the draw function is called, your images gets loaded.

And please use "local" when defining a variable :). Your player class looks good btw.!

I cleaned your code a bit :) and here is a Platformer Tutorial for LÖVE https://love2d.org/wiki/Tutorial:Platformer_Jumping . Good Luck!

main.lua

Code: Select all

require("menu")
require("player")
require("map")

-- Current gamestate
local gamestate = "menu"

function love.load()
	button = love.audio.newSource("assets/sounds/click.wav", static)
	vingette = love.graphics.newImage("assets/images/effects/vingette.png")
end

function love.update(dt)
	if gamestate == "menu" then
		--Update the menu
		menu_update(dt)
	end	
	if gamestate == "playing" then
		--Update the player
		player_move(dt)
	end
	if love.mouse.isDown("l") then
		local x = love.mouse.getX()
		local y = love.mouse.getY()
		print(x)
		print(y)
	end
end

function love.draw()
	if gamestate == "menu" then
		--Draw the menu
		menu_draw()
	end
	if gamestate == "playing" then
		--draw the map
		map_draw()
		--draw the vingette
		love.graphics.setColor(255,255,255)
		love.graphics.draw(vingette, 0, 0)
		--draw the player
		player_draw()
	end
end

function love.keypressed(key)
	if gamestate == "menu" then
		function love.keypressed(key)
			if gamestate == "menu" then
				if key == "return" then
					gamestate = "playing"
					love.audio.play(button)
				end
			end
				if key == "escape" then
					love.event.quit()
				end
		end
	end
end
menu.lua

Code: Select all

--Menu variables
local A = 255
local Seconds = 5

--load the fonts
local blurred_small = love.graphics.newFont("assets/fonts/Gaussian Blur.ttf", 25)
local blurred_medium = love.graphics.newFont("assets/fonts/Gaussian Blur.ttf", 45)
local blurred_large = love.graphics.newFont("assets/fonts/Gaussian Blur.ttf", 65)
love.graphics.setFont(blurred_large)

--Menu sounds
local intro_music = love.audio.newSource("assets/music/intro.wav", static)
love.audio.play(intro_music)

-- Image
local pi_menu = love.graphics.newImage("assets/images/effects/pi_menu.png")

function menu_update(dt)
	A = A-(255/Seconds*dt)
end

function menu_draw()
	love.graphics.setColor(255,255,255)
	love.graphics.draw(pi_menu, 0, 0)

	love.graphics.setColor(255,255,255, A)
	love.graphics.print("Press 'Enter' to start...", 45, 600)
end
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Pi, a new game (NEED HELP :S)

Post by Germanunkol »

For the teaser image, you have to upload it somewhere to the web.
  • You can use http://www.picfront.org/, for example. Select your file there (click browse), upload it (green arrow on the right).
  • After a few seconds, you'll get a display with links and your image.
  • Click on the image and a larger view will appear.
  • Right click on the large image, and click "copy image location" (if using firefox. It might be a different name if using a different browser, but should sound similar). This will copy the URL/link of your image to your clipboard
  • Then come back here, edit your post and click the "Img" button above the text-input box. Two tags will appear, [img]and[/img]. Paste your link between these tags, then press submit below.
Keep it up and good luck with the game!
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Puzzelism
Prole
Posts: 16
Joined: Wed Mar 06, 2013 2:00 am

Re: Pi, a new game (NEED HELP :S)

Post by Puzzelism »

Thank's for the help so far, I pasted in your code and am now reading that tutorial. My graphics designer is hopefully finishing up the sprites and animation to get this thing looking good
One cannot simply code love.. Oh wait with LÖVE you can..
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:56 am, edited 1 time in total.
love2d.org forum removal spell: http://pastebin.com/iVqJrbKN
User avatar
Mermersk
Party member
Posts: 108
Joined: Tue Dec 20, 2011 3:27 am

Re: Pi, a new game (NEED HELP :S)

Post by Mermersk »

I cant get past the Pi logo in the start, it just crashes. I'm running Löve 0.8. The tune in the beginning was lovely though :D
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest