I am making an infinite runner, but when I run my character is inside the floor a little bit. I made a new project with the template "Infinite Running", then changed the player graphics.
Picture from Debugger:
http://imgur.com/UKyssxq
You could try and move origin of sprite/anim to bottom of sprite and/or you could use invisible dummy sprite/object for player and then pin the actual player sprite to it. That way collision will behave more predictably.
Related
I am new to designing games and have been having trouble for the past couple of days with the animator. I have downloaded a free asset off the Unity store that included a free sprite character and also its animations for idle, walk, run, and jump. My issue is when I go to use this asset pack in my game, I can not for the life of me figure out how to transition between idle->walk, and any state->jump. I believe it has to do with no parameters being set up, as I want the walk animation to occur when my character is moving. The issue is that it seems to be stuck in idle mode. In the animator the transitions are set up, but I can not figure out how to let the animator know when I am moving, and when I am actually idle. How can I connect my characters movement scripts to be used in conjunction with the animation? Do I need to write a new script, that uses new parameters I make in the animator, or am I completely missing something? Again I am very new at this, so I apologize if this is a dumb question but I cannot figure it out. All the videos I have watched only show how to build the animations and put them into the animator, and nothing about the scripts or parameters in specific. Thank you!
Look at the animation transition requirements, then set the required values. For example:
Animator anim = obj.GetComponent<Animator>();
anim.SetTrigger("running");
or
anim.SetFloat("speed", 2);
or
anim.SetBool("running", true);
One small thing that could be going wrong: If you somehow have a reference to the prefab instead of the instantiated object in your scene, it will not work. And to be sure it's not working, play the game, find the object with the Animator in the Hierarchy, click it, and open the Animator window. You can see which state is active.
If this doesn't help, can you describe the transitions in more detail?
I'm currently building a 2d platformer and encountered a few problems.
My player has a script so that when the player hits a cube with a rigid body, the cube can be pushed. When the character pushes the object, the regular walking animation is displayed.
I want to play the pushing animation at that moment but cant seem to fix it. I read a lot of topics on the internet about the difference between unity new Animator editor and the older versions.
Is there a simple way to trigger the animation on hit, and how do I have to add it in the Animator? Also with witch states should it be connected?
Found it on google, maybe it will help
http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview
He uses a Layer for the animation of the cannon so he animates regardless of the body animation.
Simple Animation - first thought that came up, when 2 objects collided.
For example: Player collides with object Bouncer. What would happen?
Player class start bouncing animation
Bouncer class start self animation to inform user that bouncing started
this is simple animation that looks pretty good but, I have an idea how to add more realism to this and i want to, ask is it really possible to do this?
Let's say same situation player collided with bouncer
Make player invisible
In Bouncer class start animation (animation frames painted with Player and Bouncer motion (e.g preparing for jumping))
in step 2 Players position changed, putting players into position where bouncing animation ended
Make player visible
start Jump
If it is really possible, then i think this will look more realistic. Is there any sample code for this?
Animating anything in Cocos2D can be very time consuming. If you are doing vector/pixel work, you must create a frame for every single change in the animation, which can be very challenging if you don't have much in the way of an artistic background. Might I recommend something like Adobe Flash which will semi-automate the animation process. It has a function to export the animation to frames (individual PNGs), which could be turn into an animation using CCAnimation and some helper classes.
You can create your animation using After Effects, for instance, that generates a set o frames. Then you can use a software like Sprite Helper to embed that animation in cocos2d.
On your project you just have to load it and play it when you need.
http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d
I've tried searching for 'actor mask with gamesalad', 'actor image mask with game salad', and 'image mask with gamesalad', but can't seem to even find the fundamentals for creating a mask on game salad.
Basically, I would like my final result to look like something splats on the screen, and then the player wipes it off with their finger which is where the mask part comes in.
I'm not 100% sure what you're asking but I think i know what you're getting at. Do you mean that you want to erase the part of a picture where a users finger has been? Abit like some sort of finger eraser tool?
If so I hate to say that Gamesalad doesn't do this at the moment. I had a quick play to see if it could be done with image modes but didn't have any luck. The only way I could think that you could do it is by having a solid colour background (which may not be in favour of you app design) and then spawning a 1x1pixel sized actor every 0.01 second when the touch is pressed on location of the finger. This would create the illusion that an item is being erased.
Hope that helps.
I am trying to make this:
The chracter walks up to a large crate, the player presses the e key and an animation starts playing, such that the character climbs up on to the crate. (all in first person view).
So far I tried this with normal "First Person Controller" Prefab in Unity.
My code so far:
function OnTriggerStay(other : Collider){
if(other.tag == "GrabZone"){
if(Input.GetKeyDown("e")){
animation.Play("JumpToLedge");
}
}
}
However when I use this on the FPC, it will always play from the position the animation is created on. I also tried to create an empty game object, placing the FPC in there. Gives same effect.
Most recently, I tried just animating the graphics of the FPC alone. This seems to work, but since the Character Controller itself is not animated, that stays on the ground. So the whole FPC won't work anymore.
Is there anyway I could let this animation play on the local position the player is on at that time? Or can you think of any other logical solution for a grab and climb?
You should always animate from the 0,0 position. This way you can always easilyl determine what to do and where to go with your model.