• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Indie Game Development Discussion Thread | Of Being Professionally Poor

Status
Not open for further replies.
Question about Unity.

So I've got some objects I'm instantiating, but changing the scale of the object changes the scale of the prefab itself to 0, no matter what I do. It shouldn't be changing the prefab at all, just the instantiated object anyway...

Also, how can I round a float to nearest .25? Googling says float * 4 / 4 will do it, but in my instance, the only numbers this will result in is 1 or 2.

Ah, the good old * / integer trick. Actually, if memory serves, you're supposed to divide first so it will round, then multiply. Only works with non floating point numeric variables.

In your case, you need to remove the decimal before you do the / 4 * 4. I'd multiply everything by 100 converting it to an int (since .25 is in the hundredth's place), do the / 4 * 4, then divide by 100 again and convert it back to a float at this point.

However, this will NOT work for you. You asked to round to the nearest .25, not the floor. The above method only does the floor. This shouldn't be hard to fix.

Try this.

// I'm doing a shortcut. it would normally be Round(x * 100 / 4) - but 100 / 4 is 25.
x = (Mathf.Round(x * 25) * 4) / 100;

I may be missing a conversion somewhere, but I think this is the right direction.
 
I think you should hold off on the sale. I bet you could put together a much better machine for the same price. That thing doesn't even have an entry level graphics card. Your school probably offers Windows 8 installations for $25.

http://www.logicalincrements.com/

Ok I'll wait on it.

I can run what I am programming on my main desktop I am coding this on but its a laptop and I hate having to have it open and sit there in the gallery space (though hidden most likely)

I'll figure it out even if I am not a hardware sort of person :-/

I'm about 90% done with my project with just adding in the last few character stories as well as getting sound from my music person. I'll post pics once I get into it more.
 
I bet if you explain your specific use case and budget, somebody from the PC build thread can help you pick the right parts. http://www.neogaf.com/forum/showthread.php?t=745567

As far as putting it together, it's only moderately harder than Legos. You can definitely do it :)

Yeah, I've asked around computer, but because I am on a lower budget I seem to get less help. Thanks for the input though.

Depending on budget I may also just a iMac mini and dual boot it with windows.
 

Feep

Banned
Ah, the good old * / integer trick. Actually, if memory serves, you're supposed to divide first so it will round, then multiply. Only works with non floating point numeric variables.

In your case, you need to remove the decimal before you do the / 4 * 4. I'd multiply everything by 100 converting it to an int (since .25 is in the hundredth's place), do the / 4 * 4, then divide by 100 again and convert it back to a float at this point.

However, this will NOT work for you. You asked to round to the nearest .25, not the floor. The above method only does the floor. This shouldn't be hard to fix.

Try this.

// I'm doing a shortcut. it would normally be Round(x * 100 / 4) - but 100 / 4 is 25.
x = (Mathf.Round(x * 25) * 4) / 100;

I may be missing a conversion somewhere, but I think this is the right direction.

Mathf.Round(x * 4) * 0.25f;

Should work fine. This is rounding, not "flooring".
 

Hazaro

relies on auto-aim
My parts list is better than Logical Increments TYVM!
Yeah, I've asked around computer, but because I am on a lower budget I seem to get less help. Thanks for the input though.

Depending on budget I may also just a iMac mini and dual boot it with windows.
The problem is all you need is a good APU (CPU and GPU in one) and you have to go hunting for what is on sale that meets that criteria. Since your budget is so low I'd buy whatever small desktop is on sale with an AMD HD86xx APU. Not really worth putting something together unless you go hunting for used parts or machines and then you have to have too much specific knowledge.
 
My parts list is better than Logical Increments TYVM!

The problem is all you need is a good APU (CPU and GPU in one) and you have to go hunting for what is on sale that meets that criteria. Since your budget is so low I'd buy whatever small desktop is on sale with an AMD HD86xx APU. Not really worth putting something together unless you go hunting for used parts or machines and then you have to have too much specific knowledge.

thanks, yeah I don't need something powerful but I do need something that won't chug if I suddenly have 1000 instances on screen at once (which can happen even with instance cleanup I coded in).

Everyone's input has been super helpful :)
 

Galdelico

Member
Thanks you guys :) As you have probably guessed, it's a 2D shooter. Left stick controls the pilot and right stick controls the gunner. There's a lot more to it than that though but I'd rather talk more about gameplay features as we are able to show them.

No worries! :)
Really looking forward to see it in motion. It reminds me a bit of Dust's artstyle, with those chunky colors and soft shadowing... Great stuff, once again.
 

EDarkness

Member
Another week, another screenshot. I think I missed out on Saturday's screenshots, but I hope today is fine... :)

Skullforge_9.png
 

Bamihap

Good at being the bigger man
Heh, digging it :)

How are you guys doing at the moment? I saw someone from Stolen Couch (was it you?) at CCEU14 and enjoyed the talk he had with other Dutch devs about the whole business side and investors. I also enjoyed playing the game, albeit briefly, and it's actually something I'm looking forward to seeing on Steam or on Android (I've only got a loaner iPad for development purposes so I don't want tie my saves to it so I haven't even gotten the game yet). It'd be great to hear how the game's doing financially because of the investments you've gotten and how friggin much potential it has.
That was me :). Glad you liked the talk.

We've got enough funds to develop the game and start working on the next one. But we're not releasing Castaway Paradise worldwide until we're certain we can make enough money. It's been a huge undertaking. But we're confident we have something special here :).
 

cbox

Member
Code for our spawn animations is in and working perfectly! Now to get the sprite right on my end, tough working inside of xna's restrictions.

ib1YtMqH51nhbn.gif




We decided that the spawns will come when your score hits a certain level rather than a time based approach. The game counts how many and which type of enemy you have the hardest or easiest time with and then that unit is what determines which enemy comes out. Pretty cool stuff!
 

Anustart

Member
Mathf.Round(x * 4) * 0.25f;

Should work fine. This is rounding, not "flooring".

Still results in 0, 1 or 2 as the end values. The input for x is a random value between .25 and 2.

I suppose I could fix this easily by simply making the random values only be .25, .50, ..., 2.


Edit: Duh, had my Mathf.Round wrapped around the entire thing :/ Changing that now.

2nd Edit: Now for my other problem, why is changing the scale of an instantiated prefab changing the prefab itself?

Code:
GameObject newAsteroid = Resources.Load("testAsteroid") as GameObject;

        //newAsteroid.transform.localScale = new Vector3(newAsteroid.transform.localScale.x * newAsteroid.GetComponent<NeutralAsteroids>().AsteroidSize, 32f, 0f);
 

Blizzard

Banned
It turns out that I haven't gotten any better at pixel art in the last 10 years. I won't ever be able to show people the placeholder sprites, it will be a SHAMEFUL DISPRAY. :'(

I almost bought GraphicsGale to at least be able to work with animations a little easier than say, Paint.NET, but the Japanese website and UI screenshot scared me away for the moment.

I wonder what the best free tool is that makes it easy to work with multiple frames? GIMP can do layers, but is really rough for pixel art. Paint.NET can also do layers...but I guess neither lets you immediately see the result, so I would need to set up something for quick previews too.
 

Anustart

Member
It turns out that I haven't gotten any better at pixel art in the last 10 years. I won't ever be able to show people the placeholder sprites, it will be a SHAMEFUL DISPRAY. :'(

I almost bought GraphicsGale to at least be able to work with animations a little easier than say, Paint.NET, but the Japanese website and UI screenshot scared me away for the moment.

I wonder what the best free tool is that makes it easy to work with multiple frames? GIMP can do layers, but is really rough for pixel art. Paint.NET can also do layers...but I guess neither lets you immediately see the result, so I would need to set up something for quick previews too.

I can't claim to be an expert, but in my short testing making graphics for my game, I've used Tile Studio.

Shows a preview for each tile, and can preview the animations easily.
 

Blizzard

Banned
I can't claim to be an expert, but in my short testing making graphics for my game, I've used Tile Studio.

Shows a preview for each tile, and can preview the animations easily.
Thanks, that looks basic but functional! Open source is a big plus as long as there's no restriction on output licensing for commercial use.
 

amanset

Member
Code for our spawn animations is in and working perfectly! Now to get the sprite right on my end, tough working inside of xna's restrictions.

ib1YtMqH51nhbn.gif




We decided that the spawns will come when your score hits a certain level rather than a time based approach. The game counts how many and which type of enemy you have the hardest or easiest time with and then that unit is what determines which enemy comes out. Pretty cool stuff!

This is looking pretty sweet. Good work, sir!
 
i'm still looking for an artist to work with. i'm a talented programmer who is interested in building a new game which i can best describe as gauntlet meets minecraft meets orcs must die (all in 2d). will build in unity with the goal of releasing on wii u, xbox one, ps4, and steam. i am already an approved nintendo developer with access to wii u dev kits. i also have examples of my work that can be shared. pm me if interested. thanks!
 
i'm still looking for an artist to work with. i'm a talented programmer who is interested in building a new game which i can best describe as gauntlet meets minecraft meets orcs must die (all in 2d). will build in unity with the goal of releasing on wii u, xbox one, ps4, and steam. i am already an approved nintendo developer with access to wii u dev kits. i also have examples of my work that can be shared. pm me if interested. thanks!

I know we were PMing a bit roughly a year ago and it fell off due to Graduate school suddenly taking a huge plunge of my time, and that's entirely my fault.

I'm still down for working on something but I do not know what my time looks like until summer time gets closer and by then my thesis will be done.
 

_machine

Member
Hey DevGAF, I could use your input on...well input.

Basically our game has two control mechanics; jumping (and descending) and attacking depending on the height of the input. Currently it's setup to use swiping up and down for the jumping and tapping for the attacking. It used to be so that you could practically control the game with just one finger, but even after quite a bit of tweaking the game had a bit trouble deciding whether to attack or jump so we added deadzones so that there was no chance of mis-input. Some people however told us that having two different types of input tend to confuse some players, but having the attack as swipe proved to be impossible since you couldn't reliably have the high/low attack with the jump or descend.

We also thought about just having tap as input, but then how should we distinct the zones between descend and jump? We don't really have the screen estate for two buttons on the left side for them and we're not sure if having it just set to 50%/50% of the vertical screen size for the left side would be completely natural as you'd probably just tend to use the lowerleft-side of it which would be assigned for the descend only and context sensitive would probably be a bit too much work to test out right now.

So how would you go on about setting up the controls? We're going to do some AB testing, but I'd love to hear your thoughts on the matter (if I managed to explain myself well).
 

charsace

Member
Yeah, I had a feeling that was the problem, wasn't quite sure how to pull it off without messing up the walk cycle, but... Somehow, I actually managed to pull it off.

Walk2.gif


Probably not remotely perfect, but it looks so much better. The pic you showed was a great example, it really helped a lot, thanks.

I hate to be an asshole, but even though that looks better, it still looks ruff. You should focus on animating the legs first and getting the animation curve going there first because to me it doesn't look like the legs are really walking. Once you get that the rest of the animation will come along. To me your guy looks like a robot walking and I'm guessing you are going for something that looks more natural.

Watch this:
http://www.youtube.com/watch?v=J5ffy-YwybA

Search for walk animation on Youtube to see some vids.
 
I know we were PMing a bit roughly a year ago and it fell off due to Graduate school suddenly taking a huge plunge of my time, and that's entirely my fault.

I'm still down for working on something but I do not know what my time looks like until summer time gets closer and by then my thesis will be done.

that's cool, just reach out once you have a better idea of your availability and we can see where things are.
 

AlexM

Member
It turns out that I haven't gotten any better at pixel art in the last 10 years. I won't ever be able to show people the placeholder sprites, it will be a SHAMEFUL DISPRAY. :'(

I almost bought GraphicsGale to at least be able to work with animations a little easier than say, Paint.NET, but the Japanese website and UI screenshot scared me away for the moment.

I wonder what the best free tool is that makes it easy to work with multiple frames? GIMP can do layers, but is really rough for pixel art. Paint.NET can also do layers...but I guess neither lets you immediately see the result, so I would need to set up something for quick previews too.

That functionality you want is in the free version of Graphics Gale. There's a little window that's constantly playing back the animation as you work on it. If you buy the full version I believe it adds onion skin. Also the menus are all in english if you need.

Personally it's still been my favorite for pixel animation.
 
A quick question about textures and generating normal maps and such.

Just for learning purposes and prototyping, I've got some lower res free textures from cgtextures that I'm running through CrazyBump to use in Blender to make models for importing into Unity. I've found some tutorials on this process, it seems pretty straightforward and easy and I'm excited to play with it all.

I know that generally I'm going to want textures that are a multiple of 2, such as 512x512 or 1024x1024. However, free tiling textures from cgtextures are all 600x600 or 700x700.

I would like to scale them up to 1024x1024, on the off chance that I'd want to edit the textures. I'd rather work with larger textures if possible.

My question is, is it probably going to be better to scale up the textures first and then generate normal, specular, occlusion and displacement, or to generate them with the lower res file and scale all of them afterward?

I could see the blurring from up-scaling messing with the generation of a normal map or something, not giving me a good result. But I'm not sure. Maybe up-scaling a normal map after it's been generated gives you weird results too. What would you guys advise?

Also, what's the best scaling algorithm for this? Bilinear?
 
2nd Edit: Now for my other problem, why is changing the scale of an instantiated prefab changing the prefab itself?

Code:
GameObject newAsteroid = Resources.Load("testAsteroid") as GameObject;

        //newAsteroid.transform.localScale = new Vector3(newAsteroid.transform.localScale.x * newAsteroid.GetComponent<NeutralAsteroids>().AsteroidSize, 32f, 0f);

Err... "testAsteroid" being a prefab? Yeah, you're not instantiating anything there, you're loading the prefab itself and modifying it. That's why you're getting that behavior.

What you want is something like:

Code:
UnityEngine.Object asteroidPrefab = Resources.Load("testAsteroid"); //Get a reference to your prefab
GameObject newAsteroid = (GameObject)Instantiate(asteroidPrefeb); //Instantiate a new object based on that prefab

See the Unity manual for more details and explanations about instantiating prefabs: http://docs.unity3d.com/Documentation/Manual/InstantiatingPrefabs.html

That said though, you probably shouldn't use Resources.Load() to load your prefab as that method is relatively slow (it reads from disk I believe). Definitely don't call it every time you instantiate a new object in any case. I suppose you could call it just once and save the result in a member variable... but at that point, just declare a public member for your prefab, and drag it there in the editor.

Hope this helps.
 
Any other GAF members at GDC this week?

Would love to meet up in person. Indie or Professional, doesn't matter.

I'm not going since I'm not really a game developer (although I like to develop games on my free time), but I'd love to catch a beer with a few gaffers since I work a few blocks away.
 

Anustart

Member
Err... "testAsteroid" being a prefab? Yeah, you're not instantiating anything there, you're loading the prefab itself and modifying it. That's why you're getting that behavior.

What you want is something like:

Code:
UnityEngine.Object asteroidPrefab = Resources.Load("testAsteroid"); //Get a reference to your prefab
GameObject newAsteroid = (GameObject)Instantiate(asteroidPrefeb); //Instantiate a new object based on that prefab

See the Unity manual for more details and explanations about instantiating prefabs: http://docs.unity3d.com/Documentation/Manual/InstantiatingPrefabs.html

That said though, you probably shouldn't use Resources.Load() to load your prefab as that method is relatively slow (it reads from disk I believe). Definitely don't call it every time you instantiate a new object in any case. I suppose you could call it just once and save the result in a member variable... but at that point, just declare a public member for your prefab, and drag it there in the editor.

Hope this helps.

Yeah, just using Resources.Load() right now to quickly test some stuff. Some others have mentioned object pools and I'm going to be looking into that for my objects a bit further into development.
 

mihon

Member
That functionality you want is in the free version of Graphics Gale. There's a little window that's constantly playing back the animation as you work on it. If you buy the full version I believe it adds onion skin. Also the menus are all in english if you need.

Personally it's still been my favorite for pixel animation.

AFAIK, Onion skin is available in the free version. The paid version adds support for GIFs (which you probably don't need) and Windows proprietary formats, such as .ico, .cur and .ani. At least thats what the offical site is telling me.

It also my favorite tool for pixel art.
 

razu

Member
Yeah, just using Resources.Load() right now to quickly test some stuff. Some others have mentioned object pools and I'm going to be looking into that for my objects a bit further into development.

Yeah, you need pools. And they're pretty simple, and.. there are a million examples dotted around the internet. Good luck! :D


I've been busy. Got the hook attaching dynamically... (was a pain in the ass, but got there in the end!).

 

legacyzero

Banned
Yeah, I had a feeling that was the problem, wasn't quite sure how to pull it off without messing up the walk cycle, but... Somehow, I actually managed to pull it off.

Walk2.gif


Probably not remotely perfect, but it looks so much better. The pic you showed was a great example, it really helped a lot, thanks.

Do you like Spriter? I've been considering it..
 

bumpkin

Member
I don't suppose there are any collision detection superstars in our midst? I've been trying to implement tile-based collision detection in my engine, and like it has in every prior attempt, it's making me its bitch. I feel like I've tried everything and haven't come up with anything to solve several nagging issues. I captured a video below which illustrates one of 'em. Apologies for the crap framerate. Quicktime Player isn't so hot at screen recordings.

http://www.youtube.com/watch?v=Z1gI2hyUjKg

As you can see in the clip, horizontal collisions check out fine on the first few instances where I'm grounded and trying to walk into the solid tiles. It's when I get to the last one that you can see a weird jump/tunneling effect happens when the sprite is moving vertically.

FWIW, this is the code I'm running for the collision detection checks. Can anyone provide me with some help on this issue? I'm totally flustered. :(

Code:
        // Get the player's current position
        SDL_Point playerPosition = player.GetPosition();
        
        // Get the player's current speed
        SDL_Point playerSpeed = player.GetSpeed();
        
        // Figure out the player's horizontal direction
        Direction_t playerDirX;
        
        if (playerSpeed.x < 0)
        {
            playerDirX = DIRECTION_LEFT;
        }
        else if (playerSpeed.x > 0)
        {
            playerDirX = DIRECTION_RIGHT;
        }
        else
        {
            playerDirX = DIRECTION_NONE;
        }

        // Get the player's horizontal edge based on their direction; ignore anything but left and right for now
        int playerEdgeX = 0;

        switch (playerDirX)
        {
            case DIRECTION_LEFT:
                playerEdgeX = playerPosition.x;
                break;
                
            case DIRECTION_RIGHT:
                playerEdgeX = playerPosition.x + player.GetSprite()->GetWidth();
                break;
                
            default:
                break;
        }
        
        // Don't bother with the next steps if the player isn't moving horizontally
        if (playerDirX != DIRECTION_NONE)
        {
            // Get the player's vertical edges
            int playerEdgeTopY = playerPosition.y;
            int playerEdgeBottomY = playerPosition.y + player.GetSprite()->GetHeight();
            
            std::vector<Tilemap *>::const_iterator tm;
            for (tm=tilemaps.begin(); tm != tilemaps.end(); ++tm)
            {
                // Get the size of tiles
                int tileSize = (*tm)->GetTilesheet()->GetTileSize();
                
                // Figure out which rows the player is currently intersecting with
                int topRow = (int)playerEdgeTopY / tileSize;
                int bottomRow = (int)playerEdgeBottomY / tileSize;
                
                // Figure out which column the player is currently intersecting with
                int inCol = playerEdgeX / tileSize;
                
                // Iterate over the rows...
                for (int tileRow=topRow; tileRow<bottomRow; ++tileRow)
                {
                    
                    // Get the Tile
                    Tile *tile = (*tm)->GetTilesheet()->GetTileAtIndex((*tm)->GetTileKeyAtIntersection(tileRow, inCol));
                    
                    // Check if it's solid
                    if (tile->GetType() == TILETYPE_GROUND)
                    {
                        int tileEdgeX = 0;
                        //int overlapX = 0;
                        int newPlayerX = playerPosition.x;
                        
                        switch (playerDirX)
                        {
                            case DIRECTION_LEFT:
                                tileEdgeX = ((inCol * tileSize) + tileSize);
                                newPlayerX = tileEdgeX;
                                break;
                                
                            case DIRECTION_RIGHT:
                                tileEdgeX = (inCol * tileSize);
                                newPlayerX = (tileEdgeX - player.GetSprite()->GetWidth());
                                break;
                                
                            default:
                                break;
                        }
                        
                        // Adjust the player's position to the edge of the solid tile
                        player.SetX(newPlayerX);
                        
                        // Stop further movement
                        player.SetSpeedX(0);
                        
                        // Update the player's collider w/ the new coords
                        player.GetSprite()->GetCollider()->UpdateRect(newPlayerX, playerPosition.y, player.GetSprite()->GetWidth(), player.GetSprite()->GetHeight());
                        
                    }
                    
                }
            }
             
        }
 

Jack_AG

Banned
Getting enemies to recognize and use platforms that are static, moving, rotating or disappearing/reappearing to move through the environment and avoid pitfalls is real fun! NO SHIT GUYS! FUN! NOT JOKING. REALLY.
(slams face off desk repeatedly)
 

AlexM

Member
AFAIK, Onion skin is available in the free version. The paid version adds support for GIFs (which you probably don't need) and Windows proprietary formats, such as .ico, .cur and .ani. At least thats what the offical site is telling me.

It also my favorite tool for pixel art.

oh really? even better then :)
 

charsace

Member
I don't suppose there are any collision detection superstars in our midst? I've been trying to implement tile-based collision detection in my engine, and like it has in every prior attempt, it's making me its bitch. I feel like I've tried everything and haven't come up with anything to solve several nagging issues. I captured a video below which illustrates one of 'em. Apologies for the crap framerate. Quicktime Player isn't so hot at screen recordings.

http://www.youtube.com/watch?v=Z1gI2hyUjKg

As you can see in the clip, horizontal collisions check out fine on the first few instances where I'm grounded and trying to walk into the solid tiles. It's when I get to the last one that you can see a weird jump/tunneling effect happens when the sprite is moving vertically.

FWIW, this is the code I'm running for the collision detection checks. Can anyone provide me with some help on this issue? I'm totally flustered. :(

Code:
        // Get the player's current position
        SDL_Point playerPosition = player.GetPosition();
        
        // Get the player's current speed
        SDL_Point playerSpeed = player.GetSpeed();
        
        // Figure out the player's horizontal direction
        Direction_t playerDirX;
        
        if (playerSpeed.x < 0)
        {
            playerDirX = DIRECTION_LEFT;
        }
        else if (playerSpeed.x > 0)
        {
            playerDirX = DIRECTION_RIGHT;
        }
        else
        {
            playerDirX = DIRECTION_NONE;
        }

        // Get the player's horizontal edge based on their direction; ignore anything but left and right for now
        int playerEdgeX = 0;

        switch (playerDirX)
        {
            case DIRECTION_LEFT:
                playerEdgeX = playerPosition.x;
                break;
                
            case DIRECTION_RIGHT:
                playerEdgeX = playerPosition.x + player.GetSprite()->GetWidth();
                break;
                
            default:
                break;
        }
        
        // Don't bother with the next steps if the player isn't moving horizontally
        if (playerDirX != DIRECTION_NONE)
        {
            // Get the player's vertical edges
            int playerEdgeTopY = playerPosition.y;
            int playerEdgeBottomY = playerPosition.y + player.GetSprite()->GetHeight();
            
            std::vector<Tilemap *>::const_iterator tm;
            for (tm=tilemaps.begin(); tm != tilemaps.end(); ++tm)
            {
                // Get the size of tiles
                int tileSize = (*tm)->GetTilesheet()->GetTileSize();
                
                // Figure out which rows the player is currently intersecting with
                int topRow = (int)playerEdgeTopY / tileSize;
                int bottomRow = (int)playerEdgeBottomY / tileSize;
                
                // Figure out which column the player is currently intersecting with
                int inCol = playerEdgeX / tileSize;
                
                // Iterate over the rows...
                for (int tileRow=topRow; tileRow<bottomRow; ++tileRow)
                {
                    
                    // Get the Tile
                    Tile *tile = (*tm)->GetTilesheet()->GetTileAtIndex((*tm)->GetTileKeyAtIntersection(tileRow, inCol));
                    
                    // Check if it's solid
                    if (tile->GetType() == TILETYPE_GROUND)
                    {
                        int tileEdgeX = 0;
                        //int overlapX = 0;
                        int newPlayerX = playerPosition.x;
                        
                        switch (playerDirX)
                        {
                            case DIRECTION_LEFT:
                                tileEdgeX = ((inCol * tileSize) + tileSize);
                                newPlayerX = tileEdgeX;
                                break;
                                
                            case DIRECTION_RIGHT:
                                tileEdgeX = (inCol * tileSize);
                                newPlayerX = (tileEdgeX - player.GetSprite()->GetWidth());
                                break;
                                
                            default:
                                break;
                        }
                        
                        // Adjust the player's position to the edge of the solid tile
                        player.SetX(newPlayerX);
                        
                        // Stop further movement
                        player.SetSpeedX(0);
                        
                        // Update the player's collider w/ the new coords
                        player.GetSprite()->GetCollider()->UpdateRect(newPlayerX, playerPosition.y, player.GetSprite()->GetWidth(), player.GetSprite()->GetHeight());
                        
                    }
                    
                }
            }
             
        }

Your y collision and x collision should each be checked separately. Check for collision on the y axis and then check on the x axis.

Read this then try to explain it back here to us:

http://www.metanetsoftware.com/technique/tutorialA.html

Then post questions if you have any.
 
Alright, I cave. I cannot figure out why my sprite isn't lighting up in Game mode in Unity with the 2D Toolkit, only in Editor mode.

Things look fine in the Editor. I can even move the point light left and right and see accurate results.
XiQ4j4v.png


The shader on the material for the main character.
PgLTyig.png


Sprite Collection seems fine (this is where you are supposed to set normals).
ezp0o0f.png


Normals seem fine (camera is down the Z axis at -10).
ANOth2k.png


The point light itself seems fine.
hX5o5Kk.png


And yet, in Game mode (also when I build and run), no light...
EpMl4BP.png


The only light that seems to work is Directional light. Spotlight or point lights do nothing. I've spent days on this and got nowhere. Any ideas?
 
Status
Not open for further replies.
Top Bottom