Two things

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.
User avatar
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

Re: Two things

Post by TurtleP » Fri Mar 23, 2012 8:34 pm

coffee wrote:
TurtleP wrote:
coffee wrote:
You must have a exactly named "PlayerD.png" in same directory than your main.love. Also try to instead use lowercase just for debugging for now. Can you post your .Love file (zip the files inside directory)?
Yes, would you like to see my Source? Drawing a barrier seems to be a situation for me, I am not sure why though. Included are the images I am going to use.
It wouldn't let me add the .love, here's mediafire link:

http://www.mediafire.com/?vtu692pfhomsvxb
You can't attach because your wav is to big. try convert all songs or evens sounds to .ogg. LOVE play it better and take less space.
no PlayerD.png error after all. you discovered that is PlayerD.PNG right?
error on draw. it should be
love.graphics.draw(Barrier,map[y+map_y][x+map_x], x*40,y*40)
but result is horrible lol. You are scaling 40x!
Yea.. I felt my game would be best as 40x40 since all the sprites look nice. Yea, I did realized it was supposed to be .PNG (which is kinda obnoxious lol) and ok, I'll make it an ogg. Oh .. I see. Fixed that player sprite. Oh and the barriers are not aligned .. hmm

coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Two things

Post by coffee » Fri Mar 23, 2012 8:49 pm

Well, looking better for your code.
First problems:
Your sprites aren't the same size as told in map ( tile_w = 40, tile_h = 40). Player is 28x32 and barrier is 31x32. but since you aren't drawing floor it's ok.
Trying to see what you want to do.

User avatar
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

Re: Two things

Post by TurtleP » Fri Mar 23, 2012 8:55 pm

coffee wrote:Well, looking better for your code.
First problems:
Your sprites aren't the same size as told in map ( tile_w = 40, tile_h = 40). Player is 28x32 and barrier is 31x32. but since you aren't drawing floor it's ok.
Trying to see what you want to do.
So that's why my barrier is not being drawn as I want? They need to be 40x40?

coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Two things

Post by coffee » Fri Mar 23, 2012 9:01 pm

TurtleP wrote:
coffee wrote:Well, looking better for your code.
First problems:
Your sprites aren't the same size as told in map ( tile_w = 40, tile_h = 40). Player is 28x32 and barrier is 31x32. but since you aren't drawing floor it's ok.
Trying to see what you want to do.
So that's why my barrier is not being drawn as I want? They need to be 40x40?
Not the problem for now.

put this in your map
love.graphics.draw( Barrier, (x*tile_w)+map_offset_x, (y*tile_h)+map_offset_y )

so? almost there! ;)

EDITED: now try to use 40x40 size for obstacles

User avatar
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

Re: Two things

Post by TurtleP » Fri Mar 23, 2012 9:05 pm

One more thing,

Code: Select all

function love.draw()
	draw_map()
				if leftkey == true then
				animation = animation + 1
				if animation >= 0 and animation < 2 then
					love.graphics.draw(PlayerA, player.act_x, player.act_y)
				end
				if animation >=2 and animation <4 then
					love.graphics.draw(PlayerA2, player.act_x, player.act_y)
				end
				if animation >=2 then
				animation = 0
				end
				end
    end


function love.keypressed(key)
    if key == "w" then
        if testMap(0, -1) then
            player.grid_y = player.grid_y - 40
        end
    elseif key == "s" then
        if testMap(0, 1) then
            player.grid_y = player.grid_y + 40
        end
    elseif key == "a" then
        if testMap(-1, 0) then
            player.grid_x = player.grid_x - 40
			leftkey = true
        end
    elseif key == "d" then
        if testMap(1, 0) then
            player.grid_x = player.grid_x + 40
			rightkey = true
        end
    end
The thing says that animation's value is nil, I set it to zero initially.

coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Two things

Post by coffee » Fri Mar 23, 2012 9:16 pm

Your code revised. I took your wav away sorry. leave sound for later...
Your next problem. Your character draw is not accounting with map offset. see what happens if I put map offset to 0/0! all works.

EDITED:
Another "problem". Your map in table is smaller than 20/20 map size. so fill all map...
Last edited by coffee on Fri Mar 23, 2012 9:19 pm, edited 2 times in total.

User avatar
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

Re: Two things

Post by TurtleP » Fri Mar 23, 2012 9:16 pm

coffee wrote:Your code revised. I took your wav away sorry. leave sound for later...
Your next problem. Your character draw is not accounting with map offset. see what happens if I put map offset to 0/0! all works
Wow. Thanks!
Did you read my animation problem?

coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Two things

Post by coffee » Fri Mar 23, 2012 9:21 pm

TurtleP wrote:
coffee wrote:Your code revised. I took your wav away sorry. leave sound for later...
Your next problem. Your character draw is not accounting with map offset. see what happens if I put map offset to 0/0! all works
Wow. Thanks!
Did you read my animation problem?
We are out of "syncro" now. start using my "revised" and add thing there. One advise, take care first of map, then advance for animation later. sorry I "cold" resize to 40/40 your sprites.

coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Two things

Post by coffee » Fri Mar 23, 2012 9:27 pm

back to offset problem. saw the problem? replace hero draw with love.graphics.draw(PlayerD, player.act_x+map_offset_x, player.act_y+map_offset_y)
and put again offset_x and offset_y to 20 (was that the value?). Now hero is synchronized with map so you can draw map at will with offset

User avatar
TurtleP
Party member
Posts: 147
Joined: Thu Mar 22, 2012 9:20 pm
Contact:

Re: Two things

Post by TurtleP » Fri Mar 23, 2012 9:35 pm

coffee wrote:
TurtleP wrote:
coffee wrote:Your code revised. I took your wav away sorry. leave sound for later...
Your next problem. Your character draw is not accounting with map offset. see what happens if I put map offset to 0/0! all works
Wow. Thanks!
Did you read my animation problem?
We are out of "syncro" now. start using my "revised" and add thing there. One advise, take care first of map, then advance for animation later. sorry I "cold" resize to 40/40 your sprites.
I just finished the map and re sizing the player. Now..What?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 33 guests