Showing posts with label game. Show all posts
Showing posts with label game. Show all posts
Wednesday, April 4, 2012
Saturday, September 18, 2010
Keeping Their Distance
I've refined the code that determines the placement of the kids. Now the code ensures that the kids aren't placed to close. Every kid placed after the first one is checked for whether or not they are in the vicinity of any of the kids that have already been placed.
Here's a bit of code:
public bool DistanceCheck()
{
disCheck = false;
for(int i=0; i<antal-1;i++)
{
if ( ((kids[i].transform.position.x-temp.transform.position.x)*(kids[i].transform.position.x-temp.transform.position.x)) + ((kids[i].transform.position.y-temp.transform.position.y)*(kids[i].transform.position.y-temp.transform.position.y)) < 200)
{
disCheck = true;
}
}
return disCheck;
}
And a video with the latest improvement:
To sum up, reds are crying, blues are about to and green kids are okay for now. When the crying kids are tapped they turn happy (no paedophile thoughts intended).
Here's a bit of code:
public bool DistanceCheck()
{
disCheck = false;
for(int i=0; i<antal-1;i++)
{
if ( ((kids[i].transform.position.x-temp.transform.position.x)*(kids[i].transform.position.x-temp.transform.position.x)) + ((kids[i].transform.position.y-temp.transform.position.y)*(kids[i].transform.position.y-temp.transform.position.y)) < 200)
{
disCheck = true;
}
}
return disCheck;
}
And a video with the latest improvement:
To sum up, reds are crying, blues are about to and green kids are okay for now. When the crying kids are tapped they turn happy (no paedophile thoughts intended).
Friday, September 17, 2010
Touchy Success
Finally the touch input is working. I thought I would be able to "talk" directly to a method on a game object from another class e.g. objectname.method. I have now realised that I needed to use the method getComponent() to access the methods of the objects. This has taken forever to realise. But now the code works! It needs refining but it works.
When I touch the screen a ray is sent along the z-axis into the 3d space (world space I guess). Whatever the ray collides with is "registered" in the raycast method's collider. Assuming the object the the ray collides with is an Kid object I can then access the methods in the kid and change it's state.
Wednesday, September 8, 2010
We have touch down
After a lengthy process that most fittingly can be described as black magic I now have Unity Iphone and a iphone developer licence installed on the computer. Thanks for your help Christoffer.
I did some small changes in the code and now the prototype is on the ipad. "Only" problem is code registers touches in general on the screen and the specific location of the touch as you can see in the video.
To interact by touch instead of mouse click I changed this
void OnMouseDown()
{
gameObject.tag="smile";
SetCryTime();
}
to this
foreach (iPhoneTouch touch in iPhoneInput.touches)
{
if(touch.phase == iPhoneTouchPhase.Began)
{
gameObject.tag="smile";
SetCryTime();
}
}
and placed the code snippet inside the update function instead of outside. Next up is fixing the touch code so it only works on the object that are actually touched.
I did some small changes in the code and now the prototype is on the ipad. "Only" problem is code registers touches in general on the screen and the specific location of the touch as you can see in the video.
To interact by touch instead of mouse click I changed this
void OnMouseDown()
{
gameObject.tag="smile";
SetCryTime();
}
to this
foreach (iPhoneTouch touch in iPhoneInput.touches)
{
if(touch.phase == iPhoneTouchPhase.Began)
{
gameObject.tag="smile";
SetCryTime();
}
}
and placed the code snippet inside the update function instead of outside. Next up is fixing the touch code so it only works on the object that are actually touched.
Sunday, September 5, 2010
Sigh...sound
I'm attempting to make a game on my own. I'm not trying for originality (though it would be nice) the main focus is making a game from start to finish. This means I want to sketch, code, design, draw and animate my way through a mini game production trying on all the roles needed to come full circle.
In the game development endeavour I've been part of so far I've worked on the game design and the graphics. So this dogma game entails many first for me. I'm fine with the coding part actually I'm excited about the coding. Up until now I've always left the coding to the coding savvy. But lately I've passed a Java course and I'm taking object-oriented programming. So now I get to play.
No, the part I'm really scared of is the audio for the game. Though I enjoy music I rarely listen to any (I'm a talk-radio-person) and I definitely don't make any music. So where to start?
Music and sounds are really important for a game. The audio sets the tone of a game makes is fun or scary and in some cases boring. E.g. I've been playing a lot of Plants vs. Zombies lately and I really like the background sound its happy and playful and though I play for a long time it doesn't start to annoy me which is a real quality. Recently, I've also played with Kometen I initially got it for the beautiful watercolour graphics but now the real draw is the soundscape that puts you in a soothing meditative state.
So what should I do for the game audio? Of course I want funny event sounds like when a kid gets scared and starts crying. But I don't want constant crying. On its own the game play is stressful so maybe the background sound should be somewhat soothing?
In trying to add sound elements in unity which was very easy. I made two sample prototypes with background sounds borrowing audio from FlashKit and here.
For the final game I have to make the music by myself.
Organised randomness
The boxes aka the kids were in the prototype placed by hand on the scene in a grid. I did this so I could easily check if my method for making the kids near a crying child sad work. It did. So today I've worked briefly on placing the boxes/kids randomly through the code thus making the game a bite more exciting.
When placing the boxes/kids I didn't want complete randomness it would stupid if all the boxes ended up on top of each other or only in one side of the screen. I needed to organise the randomness a bit. So I've combined the random placement with a grid structure.
In the code this is accomplished with the help of a couple of for-loops. The illustration above shows the concept. For each loop A, B and C in the example there are inner loops (here illustrated with 1, 2 and 3) that picks random numbers of kids to place (here either 3 or 4) and places them at random coordinates within the intervals defines by the two for-loops. Anyway, this is how I visualised the "organised randomness" in my head before I started coding. Perhaps the code is easier to read :)
When placing the boxes/kids I didn't want complete randomness it would stupid if all the boxes ended up on top of each other or only in one side of the screen. I needed to organise the randomness a bit. So I've combined the random placement with a grid structure.
In the code this is accomplished with the help of a couple of for-loops. The illustration above shows the concept. For each loop A, B and C in the example there are inner loops (here illustrated with 1, 2 and 3) that picks random numbers of kids to place (here either 3 or 4) and places them at random coordinates within the intervals defines by the two for-loops. Anyway, this is how I visualised the "organised randomness" in my head before I started coding. Perhaps the code is easier to read :)
Friday, September 3, 2010
Screaming kids
Wednesday, September 1, 2010
First prototype and first post
I started three days ago in unity on my first game. The goal is to make a game for the ipad all by myself. I've just made my first prototype.
You can find the prototype here.
You will need to install the unity plugin to play if you don't have it already.
Rules:
- keep the squares "happy"
- green squares are the "happy" ones
- red squares are "crying"
- blue squares are about to cry because a square close to them are crying.
- click on the red squares to turn them green
Right now there is no win condition only stress.

You will need to install the unity plugin to play if you don't have it already.
Rules:
- keep the squares "happy"
- green squares are the "happy" ones
- red squares are "crying"
- blue squares are about to cry because a square close to them are crying.
- click on the red squares to turn them green
Right now there is no win condition only stress.
Subscribe to:
Posts (Atom)