Search Unity

2D Character Proof of Concept idea, Could use some pointers on how to achieve~

Discussion in 'Scripting' started by RoflBloxa, Sep 17, 2012.

  1. RoflBloxa

    RoflBloxa

    Joined:
    Sep 10, 2012
    Posts:
    10
    So, I was doing some Scripting in javascript, Which is when I come up with most of my good ideas, game related. Basically the idea is a Rectangular box on a Parralax terrain(If you don't know what a Parralax is, Google It) With a script to change the texture, For example , To change the texture when it jumps to a sprite of your jumping character, And when you hit the ground, To change it back, Simple as so, Making an illusion of a 2D Character when it is really a 3D Box, Just with it facing the camera creating the illusion it is 2D. My question Is- How would one write a script to do this? I'm semi Newb with unity, But this seems like a pretty good idea, And I'm just looking for... Ideas for Javascript on how to do it.. So, Anybody? :) If you do, Don't post an Entire... Script on how to do this. It's better to write it yourself than it is to Copy/Paste, Isn't it?
     
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Changing texture is a bit expensive, generally you want to use one texture and cycle the UV co-ordinates of your mesh (which is just a plane). Alternatively change the materials textures offsets (which is simpler and fine if you don't have too many animated objects).

    If you want to do it at as a learning project go right ahead, however there are complex tools on the asset store to do this (and more) for you or a free script available here: http://wiki.unity3d.com/index.php?title=SpriteManager
     
  3. RoflBloxa

    RoflBloxa

    Joined:
    Sep 10, 2012
    Posts:
    10
    This is probably going to be more of a Learning project, I'm probably going to make about 5 before pursuing a full game, And this is my second. I figured I would try my hand at making a 2D Project, And probably save it for later. xD I'm not going for performance, Just for functionality. Thanks for the feedback :)