Search Unity

Games [WIP] Steemdya ( adventure / action platformer )

Discussion in 'Works In Progress - Archive' started by Imaginalex, Jun 27, 2018.

  1. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Hello, i might have not made a presentation of myself, for starters i am from Belgium, and i am sorry if my english is not perfect. I am all but just a mere disabled person that spend a lot of time drawing, 3D modelling and animating, and i have a passion for what i do and like to spend a loooot, lot, lot of time on the only thing i can do for my own pleasure / entertainment and spending the long hours of the day that fly by very fast when you are deeply interested in what you are doing ^^

    So i present to you this little project i am working on right now : (i have many others in my head but i have been working a lot on this one lately )


    One problem tho... I'm a complete noob at coding... i'm not bad at making 3D models / animations and assets but for everything coding, i'm still in the process of learning c# and i'm not very much the "coder" type that ever developed his right mathematical side of the brain unfortunately so, i do what i can mostly...

    I've made a little character, his name is Steemdya and he uses a Steam engine hammer, as well as Steam boots to dash or double jump, his steam hammer is sometimes propulsed with steam energy and dashing also combust steam as some kind of stamina bar that refill over time.

    I will now present to you some animated gifs i made with the main character of the game (everything has been animated by hand with 3Ds max's biped ) :

    Accelleration / run and "braking" / decelerating :

    Running and then turning around (with weight effect :)



    Some attack animations ( Dash -> Uppercut -> mid air combo / smash to the ground )



    Simple attack :






    I've made all that in 3D even tho i can easily make 2D sprites with them, i also begun to make a very simple integration / importation of some of the things i made under unity, here's a youtube video of what i have done this far :

     
    Neviah likes this.
  2. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    And last but not least have a look at some of the background / platforms i made for this game over there on this other video :



    I will be trying to post any updates or progress i make while trying to learn more about unity scripting..
     
    deneme09 and Mauri like this.
  3. CharisVik

    CharisVik

    Joined:
    Feb 18, 2018
    Posts:
    77
    Really solid work m8. Loved it.

    Some suggestions to you from me.

    1)The camera rotation made me dizzy,if you want to keep your character at the corner of the screen all times i suggest to find a better transition that is easier for the eyes.

    2)I like the world you did.The only thing that bothered me is the bland color under the platforms. It is also interesting design but i m curious why not expand it to look like a cut wall like most 2.5 games do.

    I m the total opposite of you my friend :D, i lose track of time coding but really bored to draw and animate. Your project interest me a lot,will follow for sure for more updates!
     
  4. deneme09

    deneme09

    Joined:
    Feb 26, 2016
    Posts:
    19
  5. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Hey, thank you for replying and also, thank kyou for your feedback !

    I know the transition right to left and left to right of the camera is pretty fast, and the position of the character is not definitive yet even tho i pretty much like it to have some overhead over where you are going, i have done this reverse camera effect by placing a plane on the transform of the character, but in front of him, disabling the mesh renderer and it's materials / shadows with a target follow on this particular object so it gives that overhead / forward feel, but the rotation is pretty radical on 2.5D view.

    For the island you might be right i should cut the lower half it takes unecessary alpha / transparency ressource / space for nothing i guess.

    ----------------------------------------------------------------------------------

    Right now i'm trying to figure out how to change the parent of the handle of his hammer to his hand whenever i press an attack button, and i need it to switch from left hand to right hand but the names of the biped are something like "Bip001 R Hand" wich makes it very hard to call that GameObject for any change as spaces and all these maj / caps are not recognized by the editor or scriptor, i tried thing like "Group003.transform.parent = Biped001 R Hand.parent" i found around but i can't seem to make it work, trying to call the gameobject with these names even in private and then call the void i place after all the code to store the variable somewhere, allways returns a lot of issues (and i tried to figure this out almost all evening yesterday :( )

    Anyway thank you for your input, and thanks Deneme09 for your comment, by very light do you mean some colors are too washed out ? It's true that i use a cintiq monitor and colors are often different on other pc monitors from this one... maybe i should look closer on another computer screen. (maybe the mud is a bit light but i don't like it to pop out when there is already a lot of colorfull elements in the scene ^^
     
    CharisVik likes this.
  6. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    I think this looks really cool. My only constructive criticism is that I can't really tell where the solid ground is sometimes. When you jumped into the little hole at 2:09, where you landed is not where I expected you too.
     
    Imaginalex likes this.
  7. CharisVik

    CharisVik

    Joined:
    Feb 18, 2018
    Posts:
    77
    if u know the place of the child u can access it it's place

    gameobject.tranform.getChild(0) ->the top child for example

    you can also do a search by name

    gameobejct.transform.Find("name") -> i dont remember the exact algorithm it does and i think it only finds the children (not grandchildren)

    you can also use tags if it makes it easier for you

    to make it parent you can do

    gameobject.transform.SetParent(parent.transform, false);
    gameobject.transform.position = parent.transform.position;


    Also Caps and spaces shouldn't matter on a string. Try to double check it,typos happen a lot.

    Other way you can do it,make different animations for the other hand but i guess it will take more time? :D

    Good luck m8.
     
    Imaginalex likes this.
  8. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Thanks for answering with help ^^

    So if i follow that correctly should my code look like :


    if (Input.GetKey(KeyCode.F))
    {
    Fire1();

    if (Input.GetButtonDown("Fire1"))
    {
    animator.SetTrigger("attackOne");
    GameObject.transform.Find("Group003").SetParent(gameobject.transform.Find("Group003").transform, false);
    GameObject.Find("Group003").transform.parent = GameObject.Find("Bip001 R Hand").transform;
    }

    and when i attack with the other button :


    if (Input.GetKey(KeyCode.E))
    {
    Fire2();

    if (Input.GetButtonDown("Fire2"))
    {
    animator.SetTrigger("attackOne");
    GameObject.transform.Find("Group003").SetParent(gameobject.transform.Find("Group003").transform, false);
    GameObject.Find("Group003").transform.parent = GameObject.Find("Bip001 L Hand").transform;
    }

    it returns this error :


    error CS1061: Type `UnityEngine.GameObject' does not contain a definition for `SetParent' and no extension method `SetParent' of type `UnityEngine.GameObject' could be found. Are you missing an assembly reference?


    hmmm no it doesn't work, i'm spending so much time being stuck on this....I try a lot of different ways to write this and switch sentences / bit of code but i'm too noob for this i guess...

    Other way you can do it,make different animations for the other hand but i guess it will take more time?

    I already have one animation going for an attack going from the left hand and another one going from the right hand, but there is no way the rig let me switch parent bones while in game, and i'm way too weak in coding to figure out how to achieve the animation change between these two hands, it would mean having two of the same character in the same scene and calling one when doing one particular animation i don't think that's how it's done... i don't know...

    It's either attached to one hand already, but i need it to switch at an event like, when i press the E key or fire 2 it needs to switch from left hand to right hand for the animation to look "normal" and while the animation is still going stay in the hand, and then when attack animation is finished, it must be back on the spine 2 of the rig / bones.
     
    Last edited: Jun 27, 2018
  9. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Ok this works it transfers the Group003 to the desired bone (even tho it transfers it under the last finger which is a little bit weird tho)

    if (Input.GetKey(KeyCode.F))
    {
    Fire1();

    if (Input.GetButtonDown("Fire1"))
    {
    animator.SetTrigger("attackOne");
    GameObject.Find("Group003").transform.parent = GameObject.Find("Bip001 R Hand").transform;
    }


    That worked but i need to also change the position and pivot point of the weapon when this is going on and also i need the weapon to go back to it's former position (on spine2) after the attack is done.

    i should change the pivot point and position of the weapon " while " the attack animation plays....

    Any indication on how to change position and pivot point in script ?
     
    CharisVik likes this.
  10. CharisVik

    CharisVik

    Joined:
    Feb 18, 2018
    Posts:
    77
    Code (CSharp):
    1. if (Input.GetKey(KeyCode.F))
    2. {
    3. Fire1();
    4.  
    5. if (Input.GetButtonDown("Fire1"))
    6. {
    7. animator.SetTrigger("attackOne");
    8.  
    9. //here you look for the same gameobject and parent it to the same gameobject, SetParent you put the object you want to parent the gameobject
    10. GameObject.transform.Find("Group003").SetParent(gameobject.transform.Find("Group003").transform, false);
    11.  
    12. //this is used so it get the transform of the parent,it can be done in many other ways i did like this. Remove the .parent and put .position
    13. GameObject.Find("Group003").transform.parent = GameObject.Find("Bip001 R Hand").transform;
    14. }
    15.  
    16. and when i attack with the other button :
    17.  
    18.  
    19. if (Input.GetKey(KeyCode.E))
    20. {
    21. //do the same but change parent on .SetParent
    22. Fire2();
    23.  
    24. if (Input.GetButtonDown("Fire2"))
    25. {
    26. animator.SetTrigger("attackOne");
    27. GameObject.transform.Find("Group003").SetParent(gameobject.transform.Find("Group003").transform, false);
    28. GameObject.Find("Group003").transform.parent = GameObject.Find("Bip001 L Hand").transform;
    29. }
     
    Imaginalex likes this.
  11. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Thank you very much, i tried your thing but it returns me this :


    steemdya/script/PlayerController.cs(63,28): error CS0120: An object reference is required to access non-static member `UnityEngine.GameObject.transform'

    and also this :


    steemdya/script/PlayerController.cs(63,65): error CS0103: The name `gameobject' does not exist in the current context
     
  12. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Okay it's my fault i forgot to put this at the start :

    private GameObject gameobject;

    now the hammer stays completely detached from the character in the scene, that's weird :p

    i thought it was working but the hammer now stays in middle air and nothing else is happening might have to create some other condition on top of this for it to attach to the hand bone properly

    Also i receive errors like this if i leave GameObject written in the code :


    error CS0120: An object reference is required to access non-static member `UnityEngine.GameObject.transform'

    Frustrating to say the least

    Ok i'm trying another method by using this in the public class space :

    public GameObject hammer;
    void Example()
    {
    hammer = GameObject.Find("Group003");

    }

    i hope it will work...

    Edit :

    Ok i got it to work by using that public class and finding "Group003" and replacing it by the name "hammer" i now get to switch the hammer from one hand to another !

    Now i need to specify how the hammer is held by the pivot point on each hands when it is pressed, i need to be able to configure the position of the pivot point in the script when hitting the attack keys.
     
    Last edited: Jun 27, 2018
  13. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    I made the following public classes for the player controller script :

    Capture.JPG

    So i could link the bone objects to the hammer this way

    Capture2.JPG

    And i did this to try to transform the position / pivot but false don't work for this particular thing

    It switch successfully the hammer, but it's not in the good pose / pivot orientation and position in the hands unfortunately.
     
  14. Imaginalex

    Imaginalex

    Joined:
    Jan 29, 2018
    Posts:
    19
    Oh and i found a solution to reposition the handle right into the hand of the character, but it's too close to the beginning of the hammer, i would like the hand to drive further down the handle of the hammer but that's how the code looks for this :


    if (Input.GetKey(KeyCode.F))
    {
    Fire1();

    if (Input.GetButtonDown("Fire1"))
    {
    animator.SetTrigger("attackOne");

    hammer.transform.SetParent(hammer.transform.transform, false);


    hammer.transform.parent = righthand.transform;
    hammer.transform.localPosition = Vector3.zero;
    hammer.transform.localRotation = Quaternion.identity;

    hammer.transform.localScale = Vector3.one;

    }
    }

    capture3.JPG

    With this, it's right in his hand, but not facing the right way and not at the exact place i would want the hand to wear / wield the handle of the hammer of course. maybe i can change Vector3.Zero for y x z values but for rotation that might be something else...

    I got the right position for Right arm this way :

    hammer.transform.localPosition = new Vector3( -0.008f, 0.001f, 0.037f);

    Now just need to find a way to change the rotation especially for the left hand...

    Edit 2 :
    Okay found out the solution to do this and retarget bone, rotation, and position for the left hand :

    Changing the rotation goes like this :

    hammer.transform.localRotation = Quaternion.Euler(-161.379f, 15.812f, -36.125f);

    That's really fun to learn while doing your own game (even if it's slowly heh)

    so it looks like this for the left hand attack setup :


    if (Input.GetKey(KeyCode.E))
    {
    //do the same but change parent on .SetParent
    Fire2();

    if (Input.GetButtonDown("Fire2"))
    {
    animator.SetTrigger("attackTwo");
    hammer.transform.SetParent(hammer.transform.transform, false);
    hammer.transform.parent = lefthand.transform;
    hammer.transform.localPosition = new Vector3(-0.0177f, 0.0119f, -0.0287f);
    hammer.transform.localRotation = Quaternion.Euler(-161.379f, 15.812f, -36.125f);

    hammer.transform.localScale = Vector3.one;
    }


    And it works !

    Now i have to find a way to reset the position / bone link of the hammer on Spine2 when the character is not attacking anymore

    So here are the first results of this, i still need to be able to reset the position of the hammer at some stages :

     
    Last edited: Jun 27, 2018
    CharisVik likes this.