Jump to content

KenBrace

Active Members
  • Content Count

    58
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by KenBrace

  1. Levels are an essential part of almost every game. When the user beats a certain level they move onto the next one. This keeps the game interactive and fun.

     

    So when programming a game in C# with Unity3D how can this task be accomplished? How do we load a level after a certain event is triggered?

     

    Let's say I have a game object with a collider and I attach the following script to the object.

     

     

    using UnityEngine;
    using System.Collections;
     
    public class TriggerScript : MonoBehaviour {
    void OnTriggerEnter(Collider other){
    if(other.tag == "Player"){
    Application.LoadLevel ("Level_Two");
    }
    }
    }
    

     

    What the above code will do is detect collisions and then determine if the object that it collided with has the tag of "Player". If this is the case then the command is issued which loads the next level.

     

    The first thing we specified in the code was the two "using" statements. Those have to do with the library we are using in Unity.

     

    The second thing is the class. Everything inside this public class is for the object to which this script is attached. All of our code goes inside there.

     

    The third thing we did was issue the OnTriggerEnter function. This function is built into Unity and is called whenever a game object's trigger is activated (i.e. it is hit by an object).

     

    However it isn't good enough just to detect collisions. We need to make sure that the object it collided with was the player. We do this by creating an if() condition. If the object's tag is equal to "Player" then we run the script to load the next level.

     

    To load a level in Unity you should use the command "Application.LoadLevel();" and specify which level to load inside the parenthesis as shown in the code above. Keep in mind that in order for this level to be loadable it will need to be in the list of levels attached to the game. You can add a level by going into File > Build Settings and adding the scene to the list.

     

    If you have any questions ask them here and I'll be happy to answer them if I can.

     

     

  2. I've been trying to perfect for years.  The #1 thing to make money online is constancy, it can be hard, and I'm bad at it.  It's easy to lose focus and dedication on a project.  If you can overcome you will make money.  

     

    My highest earning now is about $500/month or so.

     

    That's pretty good. I'm only making around $200 per month at the moment.

     

    I definitely agree with what you said about consistency. This can easily be seen in popular YouTube channels. Some of them are making several videos per week. That in itself is a lot but when you keep this up for years, you can see why have become YouTube giants.

     

    I ran a forum once for about a month and then got tired of it and closed it down. I didn't have much experience back then.

     

    This January I relaunched the site and this time I know more about what I'm doing. The site is doing well and growing but the sad thing is that if I had kept up with the old one instead of quitting then it would be a lot larger than what it is today.

     

    Persistence is definitely the key.

  3. I'm out of project ideas at the moment and would like to start a web project but I don't want to carry the entire load myself.

     

    I'm mainly a back end developer but I can do both. I just don't enjoy the front end very much and find it more tedious.

     

    So are there any front end developers here interested in teaming up to create some web software?

     

    We could do pretty much anything from a software package for forums or social networks to a small web app (chatbox, record keeper, etc.).

     

    Anyone?

  4. The hardest part of web development for me is the look & feel of the site. I have a very hard time trying to come up with original & creative looking designs. I find it very difficult not to subconsciously copy designs and ideas from other sites that I like.

     

    I'm always relieved once I'm done with the front end and I can begin the fun part. Coding the brains is really fun to me because there are more challenges and logic based rather than creative based problems.

  5. If I'm going to upload a video I choose YouTube. Why? Because it's what most people use and it's somewhat of the standard video platform. It's where most people are and it's where everyone is used to watching videos.

     

    That's the advantage of becoming number one. Being #1 in itself makes you even more popular. You're the best because you're the best which exponentially grows your business.

  6. # of members doesn't really apply, the thing to monitor is how many users you have online consecutively as that's what will cause the server issues.  I really don't know where the threshold is, it really depends on how heavy your application is.  I just checked my server and I have about 300 active users browsing currently.

     

    Neither of my sites are that large so I think I'll be fine with a shared host for now. 

     

    On my larger one I get around 150,000 hits per month.

     

    I am assuming that I'd need a lot more than that to need a hosting upgrade.

  7. I have used w3schools.i think they are one of the best website that is available out there. I believe it is quite useful and totally great. It is also very easy to understand.

     

    W3Schools isn't really all that great for tutorials per se. Rather they are better for documentation. When I want to know what a function does or what function to use to complete a certain task, then W3Schools is great. Their documentation is very easy to understand.

     

    PHP Manual on the other hand has always been very hard to use for me. Everyone points to it when it comes to PHP documentation but I've never really been able to understand them. They don't explain things in a simple and concise manor.

     

    Anyone experience this? 

  8. Google your topic, from there find articles on the first say 10 pages of Google.  Go through and post quality comments with links back to your site.  As long as they are not spam they will usually be left or approved by the site owner.

     

    I've never really thought about doing this to be honest.

     

    Great idea. I will have to try it.

     

    I guess I'm a bit of a SEO novice lol. :)

  9. Yeah I use them a lot. They are good for notifying your users of new messages, alerts, etc.

     

    They are pretty easy to create and work with to be honest.

     

    The only complaint I have is that you can't send them via localhost. It is not impossible but it's frustrating as hell trying to configure the outgoing mail server to send emails. I never could figure it out myself. I just gave up and decided to work with my email scripts online.

  10. I'm running two sites (both small) and they are doing fine on a shared hosting plan from GoDaddy. One of my sites has 100 members and the other has like 50. So it will take a while before I will need to upgrade to VPS. Roughly how many members did your site have before you saw the need to upgrade Nathan?

  11. In addition, programming gіvеs you insight intо а сertаin waу of thinking whісh саn be helpful іn other walks оf life. 

     

     

    This is so true. Math has become much, much easier since I started programming. I am able to think more logically about every aspect of life really.

     

    "Everyone should learn to program because it teaches you how to think." -Bill Gates

  12. I think it has a lot to do with the type of forum. If it's a casual community where everyone knows each other, then a chatbox can be a nice way to communicated in a fun way.

     

    If it's a more serious, on-topic, Q&A sort of forum then a shoutbox can be somewhat of a distraction. Less posting, more chatting like Nathan mentioned.

  13. For sure.  I get yelled at for this at times by my boss that codes some.  He spends a lot of time with PHP errors only to find it's because he called a field in PHP that was not defined in a SQL query I wrote :)  I told him for efficiency we need to do this, but he always select *'s.

     

    Doing a SELECT * FROM is definitely easier because there is less room for error but it isn't worth the resources you are sacrificing. In my opinion it is definitely worth your time and effort to make the queries as efficient as possible; even if it means a few more errors to deal with every now and then. It pays off after the project is complete.

  14. I've seen 40+ on pages that still load quickly. I don't think the number of queries matter, but how many rows are in the tables and how efficient it's written.

     

    Maybe so. I remember one mistake that I used to always make when writing database query script is that I always wrote "SELECT * FROM" instead of selecting only the fields needed. You should only select all fields when you're going to use all or almost all of the fields in the table.

  15.  

    I did want to ask, what internet speed would be recommended for running a forum?

     

     

    I'm sure you'd want to have high speed internet. You can't really do anything with dial-up. If your internet is fast enough to use this forum then it's fast enough to run your own forum.

  16. Good to know, never knew about the CSS calc function, is that new in CCS3?  Is it used often?  Never seen it.

     

    Yeah it's new to CSS3 and only works in select browsers. It's extremely useful though so we'll see it supported across all browsers before long. At the moment you still have to use jQuery if you want it to work cross-browser.

  17. The CSS "calc()" function is great for giving an element a width based on a percentage of its parent's width plus or minus a certain amount of pixels.

     

    Example

     

     

    .this_class {
    width: calc(100% - 10px);
    }
    

     

    The above example gives the element a width of 100% of its parent width minus 10px.

     

    But the "calc()" function doesn't work across all browsers yet (i.e. Opera). So how can this be solved?

     

    Using jQuery is the answer. Below is a code example of how to do accomplish this.

     

     

    <div id='parent'>
    <div id='child'>
     
    </div>
    </div>
    

     

    Let's say I want the div with an ID or "child" to be 90% of its parent width, plus 20px. You can do this with the following jQuery code...

     

     

    $("#child").css("width", $("#parent").width() - 10% + 20px);
    

     

    In the above example I first accessed the "child" element's css width property.

     

    I then set the width by accessing the width of the "parent" and then subtracting 10% and adding 20px.

     

    Hope this helps!

  18. I would highly recommend Adam Khoury. He as a lot of great tutorials for Ajax and a bunch of other web stuff as well. One thing I really like is that he creates a lot of practical applications & projects in his tutorials. You can find his videos on his youtube channel. Definitely worth your time.

  19. One time of forum ad that really annoys me are the ads placed as posts within threads. A thread should be a list of nothing but posts. It's incredibly annoying to have posts mixed with ads.

     

    Another type of annoying ad are the ones that start blasting sound out loud but don't show themselves or provide a way to ex out. A lot of the time you can't even tell which internet tab the ad is coming from an you have to ex out of multiple browsers/tabs before the sound finally stops. Very annoying.

     

    Malware ads are of course extremely annoying as well.

  20. Sounds fascinating. Are/were you a philosophy major in college or something similar?

     

    Nah I haven't studied it in college. If I did it would turn into a responsibility and it would loose its charm. I'd rather it be driven by my own interest and not learned professionally.

     

    Anyone can do philosophy if their willing to spend lots of time in deep thought. There's a lot to think about and many different topics to consider. The key is to always think things through to the end. Many people stop as soon as their philosophy/belief encounters problems. They become uncomfortable and just stop there.

×
×
  • Create New...