Hammer smashed face

Show off your games, demos and other (playable) creations.
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Hammer smashed face

Post by jradich »

Hello world. I'm new to love, so to start out, I made hammer smashed face, a lil' interactive scene. I'll be working on this, mind you, so don't judge this version so harshly. Enjoy.

EDIT: Ok, for the past few DAYS I have been trying to figure out how to make it so that once x is pressed, all other keys (up, down, left, right) just cancel. I'm having some problems with learning lua, mostly because of time restrictions and an overall confusion with some code that's involved. here is the main.lua:

Code: Select all

--For Private Use Only

function getRelativePositioning(ax1, ay1, aw, ah, bx1, by1, bw, bh)
  local ax2, ay2, bx2, by2 = ax1 + aw, ay1 + ah, bx1 + bw, by1 + bh
  local left, right, above, below = ax1 < bx1, ax2 > bx2,  ay1 < by1, ay2 > by2
  local inside = not (left or right or above or below)
  return left, right, above, below, inside 
end

function love.load()
	
	player = love.graphics.newImage("graphics/patheticperson.png")--Loads Hammer guy.  Duh.
	
	x = 25
	y = 50
	speed = 50
	
	
	
	background = love.graphics.newImage("graphics/background.png")--Loads Background.
	
	Hammertime = love.audio.newSource("sounds/Hammer Smashed Face 8 bit.mp3", "stream")--Plays Hammer Smashed Face Continuosly!
	Hammertime:setVolume(0.5)
	Hammertime:setLooping(true)
	love.audio.play(Hammertime)

	
end

function love.draw()--Loads everything into existance.  Thank jeezus.

		love.graphics.draw(background)
		
	if love.keyboard.isDown("left") then
		love.graphics.draw( player, x + player:getWidth(89), y, 0, -1, 1, 0, 0 )
		else
		love.graphics.draw( player, x, y )
	end
		
		love.graphics.print('Hammer Smashed Face!  Press x to smash!', 0, 0)

end

function love.update(dt)--Brings movement to your angry hammer guy.
   if love.keyboard.isDown("right") then
      x = x + (speed * dt)
   elseif love.keyboard.isDown("left") then
      x = x - (speed * dt)
   end

   if love.keyboard.isDown("down") then
      y = y + (speed * dt)
   elseif love.keyboard.isDown("up") then
      y = y - (speed * dt)
   end
   
end


function love.keypressed(key)

    if key == 'x' then--I'm angry, and to express my rage, I will hit you with my hammer.
        player = love.graphics.newImage("graphics/patheticpersonshoot.png")
    end  
	
	if key == 'f' then
		love.graphics.toggleFullscreen( true )
	end
	
    if key == 'escape' then--RAGEQUIT!
        love.event.push('q')
    end 
    
    if key == 'up' then--He got hops.
    	player = love.graphics.newImage("graphics/patheticpersonjump.png")
    end
    
    if key == 'down' then--OH NO!  FAAALLLLLLLLING!
    	player = love.graphics.newImage("graphics/patheticpersonfall.png")
    end
    
end

function love.keyreleased(key)

	if key == 'x' then--Stop it!  He's already dead!
	   player = love.graphics.newImage("graphics/patheticperson.png")
	end
	
	if key == 'up' then--There comes a time where gravity pushes you around.
		player = love.graphics.newImage("graphics/patheticperson.png")
	end	
	
	if key == 'down' then--Look!  The fall didn't hurt me!
		player = love.graphics.newImage("graphics/patheticperson.png")
	end	
		
end
I'm also posting my newest .love.
Attachments
hammer smashed face.love
Hammer Smashed Face v3
(3.42 MiB) Downloaded 368 times
hammer smashed face.love
Hammer Smashed Face v2
(3.4 MiB) Downloaded 280 times
hammer smashed face.love
Hammer Smashed Face v1
(3.4 MiB) Downloaded 576 times
Last edited by jradich on Sun Mar 25, 2012 9:13 pm, edited 3 times in total.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Hammer smashed face

Post by Robin »

Something odd happens when you go to left and press x at the same time. I guess you don't have an animation for "hammering while going left" yet.
Help us help you: attach a .love.
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Hammer smashed face

Post by jradich »

Yeah and I'm having trouble making another function that doesn't conflict with the present one for x.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
waraiotoko
Prole
Posts: 33
Joined: Thu Oct 06, 2011 6:08 pm

Re: Hammer smashed face

Post by waraiotoko »

This is hilarious.
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Hammer smashed face

Post by jradich »

waraiotoko wrote:This is hilarious.
In what sense, my good sir. Hehe, good sir.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Hammer smashed face

Post by josefnpat »

New Issue:
Assign to: jradich
Type: Bug
Priority: Major
Content:

As I may be able to hammer, and hammer smash, I am unable to hammer smash face.
Running: Ubuntu Linux 11.10 x86_64
To Reproduce: Run game, hammer smash with x key.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
SoggyWaffles
Citizen
Posts: 72
Joined: Sun Jan 02, 2011 3:27 am
Location: Wyoming, USA

Re: Hammer smashed face

Post by SoggyWaffles »

Thats a "huge" file for very very little going on. Also, is anything supposed to happen?
"Beneath the clouds lives the Earth-Mother from whom is derived the Water of Life, who at her bosom feeds plants, animals and men." ~Larousse
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Hammer smashed face

Post by The Burrito »

If you're just going to mirror the sprites anyway you could simply set the X scale to -1 when drawing and add the width of the sprite to the X position whenever you're facing left.

also lols.
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Hammer smashed face

Post by jradich »

SoggyWaffles wrote:Thats a "huge" file for very very little going on. Also, is anything supposed to happen?
My good sir, nothing is really supposed to happen YET. It's a "huge" file because of the sounds and graphics. But as I get more knowledgeable about love there will be stuff happening.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Hammer smashed face

Post by jradich »

The Burrito wrote:If you're just going to mirror the sprites anyway you could simply set the X scale to -1 when drawing and add the width of the sprite to the X position whenever you're facing left.

also lols.
If you do not mind, my good sir, would you show me what you mean?
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests