Barebones Isometric Map + Camera Panning

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Barebones Isometric Map + Camera Panning

Post by ninwa »

Hello again all,

I was stuck at work today with nothing to do and I forgot to upload the latest source of my space shooting game to my webserver so I couldn't really work on it without worrying about merging changes (yes, yes, should use GIT, yada yada), so instead I started something new! I've seen a few people show off isometric maps and having never tried it before, I wanted to see how difficult it would be. As it turns out, not too hard at all! I've included a barebone isometric map display with camera panning for others who are interested to look at.

Image

Controls
  • Click and drag mouse to move camera
  • Alternatively, press shift +arrow keys to pan camera
Downloads: Feel free to modify, critique, hate, or love the code.

Regards,
Ninwa
Last edited by ninwa on Sat Oct 16, 2010 10:57 pm, edited 3 times in total.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by zac352 »

Pan, as in rotating? Are you doing this with image modification, or with scaling? :huh: I made a stupid fail. Panning is not what I was hoping for. :(
Edit: I just downloaded it. Please fix your nasty case of PO2 Syndrome. Thanks. ;)
Last edited by zac352 on Sat Oct 16, 2010 12:15 am, edited 2 times in total.
Hello, I am not dead.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by Jasoco »

Seems dragging with the mouse moves the wrong way. At least based on how dragging works in this day and age. I would say dragging would move the map with your mouse keeping the point you start on under the cursor the whole time.

Also, you need, and should, FLOOR all the image X and Y positions to avoid blurring. Simply wrap the X and Y inside math.floor() for each image call.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by zac352 »

Jasoco wrote:Seems dragging with the mouse moves the wrong way. At least based on how dragging works in this day and age.
Seems fine and logical for me. You're thinking of grabbing and dragging, like on google maps.
Hello, I am not dead.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by Jasoco »

Exactly. The other way doesn't work well at all for mouse. Especially since people will be used to dragging things around.

When you press the mouse down, record the X and Y.

Then move the camera (As long as the button is pressed) to the mouse's X and Y minus the original recorded X and Y. (I believe)
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by TechnoCat »

Jasoco wrote:Seems dragging with the mouse moves the wrong way. At least based on how dragging works in this day and age. I would say dragging would move the map with your mouse keeping the point you start on under the cursor the whole time.
Yeah, it seemed backwards to me too. The only time in RTS when it drags this way is with right click or with screen-edge scrolling.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by zac352 »

Jasoco wrote:Exactly. The other way doesn't work well at all for mouse. Especially since people will be used to dragging things around.

When you press the mouse down, record the X and Y.

Then move the camera (As long as the button is pressed) to the mouse's X and Y minus the original recorded X and Y. (I believe)
I don't like draggy scrolling because it makes your wrist sore from clicking and dragging constantly. I like clicking, then moving the mouse creating a velocity line. I do it for all of my camera movements. :|
Hello, I am not dead.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by ninwa »

I see what you guys are saying about the scrolling. I think it may be a preference thing but I would agree that the default behavior should be making the terrain draggable. Feel free to re-download the .love file as I updated the camera as well as demonstrated multi-z-levels. I'm not going to post for awhile however until I have something real awesome to show. Thank you guys for checking it out. :)

-Nin
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by zac352 »

ninwa wrote:I see what you guys are saying about the scrolling. I think it may be a preference thing but I would agree that the default behavior should be making the terrain draggable. Feel free to re-download the .love file as I updated the camera as well as demonstrated multi-z-levels. I'm not going to post for awhile however until I have something real awesome to show. Thank you guys for checking it out. :)

-Nin
Uh. Are you ever going to fix the images making giant white boxes?
Hello, I am not dead.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: Barebones Isometric Map + Camera Panning

Post by ninwa »

zac352 wrote:
ninwa wrote:I see what you guys are saying about the scrolling. I think it may be a preference thing but I would agree that the default behavior should be making the terrain draggable. Feel free to re-download the .love file as I updated the camera as well as demonstrated multi-z-levels. I'm not going to post for awhile however until I have something real awesome to show. Thank you guys for checking it out. :)

-Nin
Uh. Are you ever going to fix the images making giant white boxes?
I've padded the cube image so this should no longer happen. Let me know if it works!
Post Reply

Who is online

Users browsing this forum: No registered users and 83 guests