[QUOTE=stickmoos;44092991]here's a dumb space game I'm working on
[unity]https://dl.dropboxusercontent.com/u/67305390/unity/PlanetSmasher.unity3d[/unity]
the mouse dragging / selecting gets fucked up sometimes which I'm trying to fix[/QUOTE]
I was amused when the orbital defences are on the opposite side of the planet to the incoming meteor, they actually just start strafing the Earth :P
[QUOTE=stickmoos;44092991]here's a dumb space game I'm working on
-unity-
the mouse dragging / selecting gets fucked up sometimes which I'm trying to fix[/QUOTE] Oh lord the explosions are amazing.
[QUOTE=stickmoos;44092991]here's a dumb space game I'm working on
the mouse dragging / selecting gets fucked up sometimes which I'm trying to fix[/QUOTE]
That WASD movement threw me off. Looking cool so far!
[QUOTE=Proclivitas;44088347][URL="http://i62.tinypic.com/i3gakj.png"]http://i62.tinypic.com/i3gakj.png[/URL]
[URL="http://i60.tinypic.com/148lug5.png"]http://i60.tinypic.com/148lug5.png[/URL]
Am I to be forced to have this scene look this bad in the free version?[/QUOTE]
No one can answer that without knowing what you want it to look like. You could add some lights / bake lighting to start.
[QUOTE=BoowmanTech;44085131]Hello
I am trying to use raycast for my player movement so when it hits a block on the right or left side it stops moving.
I tried to look at how it is being used but it's kinda confusing.
Could someone post an example and explain it.
Thank You[/QUOTE]
Depends on your movement, coded in C# btw.
[code]
// Get Direction based on where you are moving.
Vector3 dir = new Vector3( Input.GetAxis("Horizontal"), 0, Input.GetAxis ("Vertical"));
// Create a ray from the gameobject's origin, have it face forward on z direction no matter what (Thus the multiplication of transform.rotation)
Ray rayDirection = new Ray(transform.position, transform.rotation * dir );
// Calculate and see if the raycast do hit something, i.e. an object with collider. (IgnoreMask partially works?)
if(Physics.Raycast(rayDirection) )
{
// TODO - This is where you would tell your player to stop moving here because it hit a collider.
}
[/code]
Just a FYI - Raycast do hit collider regardless if they are trigger or not. If you want to ensure that the player's movement is shut off on a collider not trigger, you would have to use the "out hit" function, and do a check of collider.isTrigger.
I wanted to try see if I could do boardgame movement etc. then took it a bit further to start expanding on a base game idea, thus resulting is this tiny little prototype. Not visible is some stuff that has been implemented but has no visual or gui aspect yet.
- Player token moves 6 spaces and can do complete loops around as per a normal boardgame, currently just moves 6 spaces (or whatever I set) but will expand to a die system.
- The base apartment unit blocks generate random tenants with names and ages using a random name script I made. Due to in part using System.IO it means I couldn't make a webbuild but I might just have it use WWW for web if that is possible.
- Made an object selection system as well.
- Added some visual fluff such as a simple day night cycle that has working Midnight to Midnight timing, currently set for an in game day to be 1 minute of real time.
[media]http://www.youtube.com/watch?v=Cu5MF5H77sc&feature=youtu.be[/media]
I know it's not much and it's really shit, but I this is the first thing I've done in Unity.
I just started learning a few days ago and I was just messing.
I didn't want to put to much effort in this because I made it just to improve my skills.
[unity]http://boowman-portofolio.co.uk/game_boowman_winner/SlimeGlob.unity3d[/unity]
Link to the .unity3d file instead of the .html file for the facepunch unity thing to work
[QUOTE=Huabear;44099818]Link to the .unity3d file instead of the .html file for the facepunch unity thing to work[/QUOTE]
Done, didn't know I had to link that file.
[QUOTE=Huabear;44097698]I wanted to try see if I could do boardgame movement etc. then took it a bit further to start expanding on a base game idea, thus resulting is this tiny little prototype. Not visible is some stuff that has been implemented but has no visual or gui aspect yet.
- Player token moves 6 spaces and can do complete loops around as per a normal boardgame, currently just moves 6 spaces (or whatever I set) but will expand to a die system.
- The base apartment unit blocks generate random tenants with names and ages using a random name script I made. Due to in part using System.IO it means I couldn't make a webbuild but I might just have it use WWW for web if that is possible.
- Made an object selection system as well.
- Added some visual fluff such as a simple day night cycle that has working Midnight to Midnight timing, currently set for an in game day to be 1 minute of real time.
[media]http://www.youtube.com/watch?v=Cu5MF5H77sc&feature=youtu.be[/media][/QUOTE]
That's cute. Try making the lights in the buildings come on at random times towards night.
Is it a good idea to store the InstanceID to use to tell the script which specific object I am referring to? Seems preferable to store just an ID in a variable instead of storing a GameObject for optimization reasons.
[QUOTE=acds;44101483]Seems preferable to store just an ID in a variable instead of storing a GameObject for optimization reasons.[/QUOTE]
What optimization reasons? It's just a reference anyway.
Cubiquity, highly customizable, high quality, cross platform 3D voxel engine.
[url]http://www.volumesoffun.com/tag/cubiquity/[/url]
[url]http://forum.unity3d.com/threads/180334-Voxels!-Introducing-Cubiquity-a-voxel-plugin-built-with-C-and-PolyVox[/url]
Did I mention it was free?
I don't even know what to call it, D* with self optimization?
The search is surprisingly fast.
[IMG]http://puu.sh/7gztO.png[/IMG]
EDIT: Since you're active in this thread garry, are you going to the BAFTAs?
So I've been using Hammer to build the basics of levels. I only care about the brushes and will do the textures/lighting in Unity.
To get from Hammer to Unity, I've been exporting at a .DXF because that gives me all of the brushes as separate objects. Then I can easily throw box colliders on them and they work fine. The problem is, for every brush, which is a child of the level as a whole, has a transform of (0, 0, 0).
I can apply textures to cubes I make in Unity, but not to any of the objects I imported into Unity(they just appear dark), presumably because of this transform problem.
Does anyone have any idea on how to fix this? Alternatively, what is the best way to get brushes from Hammer into Unity so they are all separate objects?
Thanks in advance for anything.
[QUOTE=Darkest_97;44106752]So I've been using Hammer to build the basics of levels. I only care about the brushes and will do the textures/lighting in Unity.
To get from Hammer to Unity, I've been exporting at a .DXF because that gives me all of the brushes as separate objects. Then I can easily throw box colliders on them and they work fine. The problem is, for every brush, which is a child of the level as a whole, has a transform of (0, 0, 0).
I can apply textures to cubes I make in Unity, but not to any of the objects I imported into Unity(they just appear dark), presumably because of this transform problem.
Does anyone have any idea on how to fix this? Alternatively, what is the best way to get brushes from Hammer into Unity so they are all separate objects?
Thanks in advance for anything.[/QUOTE]
Well, there's the [url=https://github.com/assassini/unity-vmf-loader]VMF importer[/url] I've been working on, but it's still work in progress.
[editline]3rd March 2014[/editline]
Texture coordinates are parsed, but they have the wrong scale as textures themselves aren't imported yet.
Is there any way to create a function and make it available to every script in my project? I'm making a ship building game and basically every single part in it is going to be loaded from text scripts and images in a number of folders, visuals/2D/hulls/USBattleship1, partstats/hulls/USBattlehip1, visuals/3D/hulls/USBattleship1, etc. Anyways, I'm writing a parsing code to automatically merge the name with the folder I need to be looking for to get a valid URL, and I want this code to be available to all my scripts without having to paste the function into every single one.
[QUOTE=Trekintosh;44110633]Is there any way to create a function and make it available to every script in my project? I'm making a ship building game and basically every single part in it is going to be loaded from text scripts and images in a number of folders, visuals/2D/hulls/USBattleship1, partstats/hulls/USBattlehip1, visuals/3D/hulls/USBattleship1, etc. Anyways, I'm writing a parsing code to automatically merge the name with the folder I need to be looking for to get a valid URL, and I want this code to be available to all my scripts without having to paste the function into every single one.[/QUOTE]
You could create a base class and derive from it on everything that needs it.
[QUOTE=Skipcast;44111085]You could create a base class and derive from it on everything that needs it.[/QUOTE]
Could you make that a little more basic, please? I never figured out what exactly classes are, or how I inherit them from things, and none of my programming books were able to explain it in a way I could understand. I just want to be able to call the function like "Stringparse("2DSprite","USBattleship1") and have it return "assets\Visuals\2D\USBattleship1.png" for example. I can make that code easily, but i want to be able to call Stringeparse from any script.
I have an additional question. I'm trying to load my sprite up from a given string. What I'm using now is "gameObject.GetComponent(SpriteRenderer).sprite=Name;", where Name is the string that should be the sprite's name. If I click on the SpriteRenderer's empty Sprite variable, I get a list of all the sprite assets I have access to. However it gives me "Cannot convert String to UnityEngine.Sprite" How can I get my code to do this?
[QUOTE=Trekintosh;44111212]Could you make that a little more basic, please? I never figured out what exactly classes are, or how I inherit them from things, and none of my programming books were able to explain it in a way I could understand. I just want to be able to call the function like "Stringparse("2DSprite","USBattleship1") and have it return "assets\Visuals\2D\USBattleship1.png" for example. I can make that code easily, but i want to be able to call Stringeparse from any script.
I have an additional question. I'm trying to load my sprite up from a given string. What I'm using now is "gameObject.GetComponent(SpriteRenderer).sprite=Name;", where Name is the string that should be the sprite's name. If I click on the SpriteRenderer's empty Sprite variable, I get a list of all the sprite assets I have access to. However it gives me "Cannot convert String to UnityEngine.Sprite" How can I get my code to do this?[/QUOTE]
I'm not very good at explaining things, but i'll try.
In C#, you'd create a class and derive from it like this:
[cpp]
public class HumanBeing
{
public string Name;
public DateTime Birthday;
public int Weight;
public HumanBeing(string name, DateTime birthday)
{
Name = name;
Birthday = birthday;
Weight = 75;
}
public void Eat(int amount)
{
this.Weight += amount; // the "this" keyword isn't needed here unless for example a parameter in the method is named the same thing.
}
public virtual void Greet(HumanBeing human) // "virtual" means that the method can be overriden in a derived class.
{
Console.WriteLine(this.Name + " greets " + human.Name);
}
}
public class Bob : HumanBeing // adding " : BaseClassName" will make this class derive from the specified class.
{
public Bob() : base("Bob", new DateTime(1965, 8, 5) // adding " : base(...)" will call the base classes constructor so you won't have to write the same constructor in every derived class.
{
this.Weight = 80; // remember that we're deriving from the base class. this enables us to access the base class's members.
}
public override void Greet(HumanBeing human)
{
Console.WriteLine("Bob says hello to " + human.Name);
// You can call the base method by calling base.Greet(human); That would output: Bob greets OtherHuman. Assuming the other HumanBeing's Name variable would be "OtherHuman".
}
}
static class Entry
{
public static void Main(string[] args)
{
HumanBeing human = new HumanBeing("My name", new DateTime(1985, 5, 17)); // My name, born 17th may 1985
Console.WriteLine(human.Weight); // outputs 75
human.Eat(20);
Console.WriteLine(human.Weight); // outputs 95.
HumanBeing human2 = new HumanBeing("Second person", new DateTime(1982, 2, 12));
human2.Greet(human); // outputs: Second person greets My name
Bob bob = new Bob();
bob.Greet(human2); // outputs: Bob says hello to Second person
}
}
[/cpp]
Regarding your 2nd question, that's because the sprite variable isn't a string.
It's probably a Sprite: [url]http://docs.unity3d.com/Documentation/ScriptReference/Sprite.html[/url]
[QUOTE=DarKSunrise;44110483]Well, there's the [url=https://github.com/assassini/unity-vmf-loader]VMF importer[/url] I've been working on, but it's still work in progress.
[editline]3rd March 2014[/editline]
Texture coordinates are parsed, but they have the wrong scale as textures themselves aren't imported yet.[/QUOTE]
Awesome thanks. Now where exactly do I put the files to use this, I'm relatively new to Unity.
[QUOTE=Skipcast;44111381]I'm not very good at explaining things, but i'll try.
In C#, you'd create a class and derive from it like this:
[cpp]
public class HumanBeing
{
public string Name;
public DateTime Birthday;
public int Weight;
public HumanBeing(string name, DateTime birthday)
{
Name = name;
Birthday = birthday;
Weight = 75;
}
public void Eat(int amount)
{
this.Weight += amount; // the "this" keyword isn't needed here unless for example a parameter in the method is named the same thing.
}
public virtual void Greet(HumanBeing human) // "virtual" means that the method can be overriden in a derived class.
{
Console.WriteLine(this.Name + " greets " + human.Name);
}
}
public class Bob : HumanBeing // adding " : BaseClassName" will make this class derive from the specified class.
{
public Bob() : base("Bob", new DateTime(1965, 8, 5) // adding " : base(...)" will call the base classes constructor so you won't have to write the same constructor in every derived class.
{
this.Weight = 80; // remember that we're deriving from the base class. this enables us to access the base class's members.
}
public override void Greet(HumanBeing human)
{
Console.WriteLine("Bob says hello to " + human.Name);
// You can call the base method by calling base.Greet(human); That would output: Bob greets OtherHuman. Assuming the other HumanBeing's Name variable would be "OtherHuman".
}
}
static class Entry
{
public static void Main(string[] args)
{
HumanBeing human = new HumanBeing("My name", new DateTime(1985, 5, 17)); // My name, born 17th may 1985
Console.WriteLine(human.Weight); // outputs 75
human.Eat(20);
Console.WriteLine(human.Weight); // outputs 95.
HumanBeing human2 = new HumanBeing("Second person", new DateTime(1982, 2, 12));
human2.Greet(human); // outputs: Second person greets My name
Bob bob = new Bob();
bob.Greet(human2); // outputs: Bob says hello to Second person
}
}
[/cpp]
Regarding your 2nd question, that's because the sprite variable isn't a string.
It's probably a Sprite: [url]http://docs.unity3d.com/Documentation/ScriptReference/Sprite.html[/url][/QUOTE]
Would it be possible to have one class derive from both HumanBeing and Monobehaviour?
I don't think C# allows for that, but I have no idea.
[QUOTE=Pelf;44119396]Would it be possible to have one class derive from both HumanBeing and Monobehaviour?[/QUOTE]
C# doesn't have multiple inheritance (for a good reason). The way to do this is to either "chain" your inheritence (ie, a class which inherits HumanBeing which inherits MonoBehaviour) or doing something similar to your goal with interfaces.
So I want to get really good at Unity, mostly at programming. I've got the basics since I finished my first 2D Game. From there I wanted to start making game controller for 3D games, and from there just to create random things in Unity until I get good at it and I understand almost everything. I started working on the game controller and I got stuck because it didn't work how I was expecting, and that's it.
Anyone could link me all sorts of documentation you used to start using Unity and get good at it.
If possible for JavaScript.
[QUOTE=BoowmanTech;44125999]So I want to get really good at Unity, mostly at programming. I've got the basics since I finished my first 2D Game. From there I wanted to start making game controller for 3D games, and from there just to create random things in Unity until I get good at it and I understand almost everything. I started working on the game controller and I got stuck because it didn't work how I was expecting, and that's it.
Anyone could link me all sorts of documentation you used to start using Unity and get good at it.
If possible for JavaScript.[/QUOTE]
Think of a fun small Unity 3D project and start making it. If you run into problems, try to fix the problems. You'll learn more from that than from reading endless tutorials and unity docs.
[QUOTE=BoowmanTech;44125999]So I want to get really good at Unity, mostly at programming. I've got the basics since I finished my first 2D Game. From there I wanted to start making game controller for 3D games, and from there just to create random things in Unity until I get good at it and I understand almost everything. I started working on the game controller and I got stuck because it didn't work how I was expecting, and that's it.
Anyone could link me all sorts of documentation you used to start using Unity and get good at it.
If possible for JavaScript.[/QUOTE]
It also helps to break down anything you code into components, makes it easier to debug and with proper coding you can add reusability to existing codes.
[QUOTE=Asgard;44126039]Think of a fun small Unity 3D project and start making it. If you run into problems, try to fix the problems. You'll learn more from that than from reading endless tutorials and unity docs.[/QUOTE]
I've got an idea of a small 3D project, but It still requires me to make a game controller.
I will give it a shot.
So you all suggest I would rather make small things then watching tutorials.
I found [url=http://www.youtube.com/playlist?list=PLPV2KyIb3jR7F_B4p8X3YwHPaExh0R9Kk]this guy[/url] and I wanted to start watching his tutorials, but idk.
[editline]4th March 2014[/editline]
[QUOTE=atrblizzard;44126352]It also helps to break down anything you code into components, makes it easier to debug and with proper coding you can add reusability to existing codes.[/QUOTE]
What do you mean break down my code ?
I assume that something I made I know how I made it and I did not copied it.
I went through his tutorials.
One tip: LEARN
[QUOTE=BoowmanTech;44126620]I've got an idea of a small 3D project, but It still requires me to make a game controller.
I will give it a shot.
So you all suggest I would rather make small things then watching tutorials.
I found [url=http://www.youtube.com/playlist?list=PLPV2KyIb3jR7F_B4p8X3YwHPaExh0R9Kk]this guy[/url] and I wanted to start watching his tutorials, but idk.
[editline]4th March 2014[/editline]
What do you mean break down my code ?
I assume that something I made I know how I made it and I did not copied it.[/QUOTE]
I have to admit I haven't really been following this thread, so sorry if you've already posted about this before, but what do you mean with a game controller?
Sorry, you need to Log In to post a reply to this thread.