Hello Guest

Author Topic: Whack a Mole Tut Help/Basic Questions  (Read 7759 times)

BBaller1337

  • Newbie
  • *
  • Posts: 3
    • View Profile
Whack a Mole Tut Help/Basic Questions
« on: September 21, 2013, 04:35:26 am »
Hi,

I'm new to Unity trying to build a 2D (not 2.5D) platforming game. Having done some research I heard 2D Toolkit was good for 2D games in general so I thought it'd be a good start. Unfortunately I'm already running into some trouble.

In the Whack a Mole tutorial, it wants me to create a background which may ultimately result in something like this. However when doing the part where I insert the Fields (see http://unikronsoftware.com/2dtoolkit/doc/2.20/tutorial/whack_a_mole/game_objects.html section "Putting Sprites in the Game" step 2), it doesn't display properly in the "Game" menu. I tried changing my pixels per meter to 1 (it was 20 but I noticed one of the images had it changed to 1) and I tried redoing the steps but to no avail.

I can kind of get it to work by scaling it but if the image has a width of 1024 and my game's resolution is 1024, I should be able to insert it with no need for scaling, correct? I ultimately want to create a game with a resolution of something like 640 x 360 and I'm having all the graphics drawn for this resolution so if I have to have things oddly scaled it's going to really be a pain...

Here are a few pictures to help show my situation:

http://gyazo.com/5411c7bfb3355faddebb730e0854bfa3.png
http://gyazo.com/82f08df1164108cfea0ce835cffb0d64.png
http://gyazo.com/e77eb70cf99403207fcf646cc926b666.png

Thanks for any insight anyone can offer into what's causing the problem and how I can solve it.

And on a side note, if anyone has any suggestions for using 2D Toolkit to create a 2D platformer... I would love them. I'm also worried about upscaling from 640x360 (native res) to 854x480 and 1280x720 (Wii U gamepad/720p res) and have no idea how that would work in a 2D project like this (I just want something very simple to implement but without grey bars and they're all the same aspect ratio so...) but maybe this isn't the right place for this, haha...

(Heck, I would be willing to pay someone to help hold my hand sometimes so I don't spend hours getting stuck on simple things/the learning process and can focus on actually making the game...)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #1 on: September 21, 2013, 11:57:01 am »
You haven't created the tk2dCamera in that scene yet, are you sure you're following the tutorial correctly? Creating the sprites at the right size is one step, the second is to create the camera with exactly the same settings. Everything should just work as expected as long as pixels per meter settings match.

If you're stuck or think you've made a mistake somewhere - there is an unitypackage at the end of every page of the tutorial with the completed steps in there for you to compare with.

About rescaling - there are a lot of options . If you're not bothered about being pixel perfect, you can simply add a default override in the tk2dCamera, and this will automatically rescale the contents to fit the other resolutions.

BBaller1337

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #2 on: September 22, 2013, 02:38:48 am »
More questions:

- when I imported the whole, I had to scale it to 20x its supposed size to get it to be viewable, but the graphic size should be big enough that it doesn't need scaling. Why is this? I need things to resolve at their actual resolution that they are from their source image, without anything to complicate it, so I'd really like to understand how this works...

- also, the elements underneath it (dirt, mole) were very sensitive in terms of X and Y position--the tutorial said it had a Y-pos of "60" to get it to be right, but mine only took 3.5 (I have a feeling this might have to do with my scaling, because 3.5*20 = 70 which is close to 60)

- at the end is a .unityPackage, how can I use it to look at the example project to this point? Trying to import it just makes it import a bunch of assets... I was hoping I could see exactly what was been done so I could compare and use it to really fortify my learning experience.

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #3 on: September 22, 2013, 11:23:25 am »
As mentioned on the previous post, you've missed the first few (rather essential) steps. You create the camera, and then create the sprite collection with the same settings -  This is really important to get the scaling correct. I'm guessing you missed step 7 (set pixels per meter to 1)...

After importing the unitypackage, you will be able to find the scene with the previous steps all complete. You can then compare that to what you've done.

BBaller1337

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #4 on: September 22, 2013, 05:29:05 pm »
I did originally create the camera but I think at some point while I was playing with things I reverted to the old one. Anyhow, I recreated it again afterwards, so that's not the issue... the issue was the Pixels Per Meter setting, as you said. I forgot to set one of them to "1" again. My apologies for the tiny mistakes, I'm not very familiar with what to check yet so it didn't really occur to me that would be it (I thought it'd have to do with the scaling).

As for the unity package, I wasn't able to see the scene (it just continued to show mine after I imported it), but I'll try again when I have time. Thanks for the help again.

Zerroth

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #5 on: September 23, 2013, 12:39:00 pm »
Hey there,

I just started your 2DToolkit tutorial there and I am currently on the Creating the GameObjects page.  I am stuck on steps 11 to 13.

" Change both of these values to 64 and click 'Apply'. This will split each of the images up into 64 x 64 blocks"

When I did this, (highlighted the 5 field images and selected diced and clicked apply) red boxes appeared like so:

http://imagesup.net/?di=16137993581616

I never seem to get this:

unikronsoftware.com/2dtoolkit/doc/2.10/tutorial/whack_a_mole/img/atlas_dice.png

I went to settings and changed Max Size to "2048".  I still seem to get the "Unable to fit textures in requested atlas area" when I click commit.

I also notice my Atlas Width, Atlas heigh and Atlas Wastage are all zero where as you have numbered values like 1024,2048 and 19.81%.  If that means anything.

Any help is appreciated.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #6 on: September 23, 2013, 09:05:24 pm »
That image in atlas_dice is the image of the atlas. You'll only see that after you have built your sprite collection. Select each of the background images and make sure you have diced all of them. If you still get "Unable to fit textures in requested atlas area" it means it hasn't successfully built your atlas, and until you have the Atlas Width, Atlas heigh and Atlas Wastage values won't make much sense.

If you can't work out where you've made the mistake, you can get the completed sample unitypacakge at the end of the tutorial page and compare with that.

Charles256

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #7 on: September 26, 2013, 01:29:36 am »
I've loaded up the project provided and I noticed several differences. Only one of their images are diced. Also, under settings even though I've set the max size to 2048 the atlas width and atlas height still show as different. Any idea what might be different? Would you mind running through the tutorial, as written, from a clean set up to see if you hit the issue?

Edit: This message has been edited for politeness. :)
« Last Edit: September 26, 2013, 03:25:09 pm by Charles256 »

Charles256

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #8 on: October 04, 2013, 10:08:24 pm »
I was able to resolve this issue after trying two new projects and importing the 2dtoolkit two more times. Third time is the charm so to speak. I never could figure out what caused it but trying again two more times did the trick. I suspect my computer hates me.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #9 on: October 05, 2013, 12:44:53 pm »
I'm guessing you maybe forgot to click Apply after modifying the multiselection? Apply is the thing that propagates the value to the other selected items, otherwise you're just modifying the active selected item only.

catacasa

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #10 on: October 05, 2013, 09:49:55 pm »
I'm still stuck at Step 11.

I've selected all 5 fields, set Render Mesh to Diced, set Dice X to 64 and Dice Y to 64, and clicked Apply. After that I have double-checked each of them and they are all set to Diced with the correct values. I went to Settings and changed the Max Size value to 2048 (under Atlas Settings) and then clicked Commit. I get the same error message as shown in step 8.

Not sure what I'm doing wrong, but I've gone through the tutorial a couple times now and step 11 is as far as i can get.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #11 on: October 08, 2013, 04:08:25 pm »
I've just checked this again, and after setting Diced to 64, 64, max size to 2048 - I don't get the error message at all. Have you accidentally picked the textures in the 2x folder?

catacasa

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Whack a Mole Tut Help/Basic Questions
« Reply #12 on: October 12, 2013, 09:48:03 pm »
My fourth attempt worked. I made sure to choose the files in the Textures folder this time. I'm going to assume I was choosing the files in the 2x folder the first three attempts.

Thanks!