I use CCFollow to keep player position center of screen.
And, I also use CCParticleFire as player's child node.
Problem is, when player runnning, particle don't represent particle's afterimage.
(Particles was not affected by player's move.)
(Particles remain several seconds in position where player was standing if I don't use CCFollow.)
I want to affect player's move to particles.
Anyone knows how to do this?
Related
I used to have a game object used as a sword with sprites with a specific size, despite including quite a bit of transparent space, to ensure these are aligned properly with the player game object:
This ensures the sword follows the player as he jumps by making use of the hero transition like this transform.position = hero.transform.position; , and though there may be issues with sprite changes I would address these later.
However, since I want to have several different equipment, and other sprites of this same sword might need a bigger dimension to look good (such as a sword attack while standing on the ground), I could either make even bigger sprites which would eventually affect performance due to transparent pixels loading, or I thought of making sprites with specific sizes:
(if this works I'd make sure to draw and put them close together instead of being separate)
And although when I prepare the animation I make sure to shift the position of the new sword to where it would be based on the player sprite on its own air attack animation (thus I had to modify this frame by frame,
The sword doesn't seem to follow the player, even when its game object still uses the script that makes use of the player's transform position:
I'm assuming something else has to be changed frame by frame, but what could it be? Is there a way to align or anchor a smaller sprite to follow the pivot of a bigger sprite?
All rotation or changing of sprites is done relative to the sprite's Pivot Point.
When you currently swap your sprites, your sword looks like it is rotating on it's blade rather than the handle.
Change the Pivot point to the handle, and it will do most of the work.
The rest is just making sure the handle of the sword follows the character's hands.
I would like to create a script (2D game)which can detect Player collision with tile from Tilemap named "Middle" and slow player. Problem is I dont know how to extract Tiles position from Tilemap in c# script.
Can i check that Player position and Tiles positions?
I would just make a trigger that encompasses the region that you want to slow player on and have one method in the player move script that lowers the player move speed and is called on entering the trigger and one that increases the player move speed and is called when exiting the trigger instead of positioning. I would also look into terrain and how you might use it with tile maps
Currently, when I shoot a bullet is instantiated at the muzzle of my gun. Then rotated to aim at a point x distance in front of the camera. I imagine this will result in a convergence effect as shots are fired further distances resulting in extremely offset aiming.
Surely this is not the correct way to instantiate bullets in an FPS so what is the standard?
You have two options:
For very fast/instant shots- you should just check if the player "clicked" on the opponent (probably with a Raycast from the player's POV), without generating the actual shots (maybe generate something only for graphics), this way no room for mistakes in aim.
For real bullets with calculated physics- the bullet should be instantiated from the POV of the player, even one step further (or displayed when far enough) so it won't appear too big on the player's screen. About aiming, now it won't have any offset since it shot from where the player sees the crosshair, not the actual gun. You can keep the shooting animation so it "feels" like it shot from the gun.
Sorry I know the title is really confusing.
Basically the camera and hands are nested under an empty object. This empty object is then used to rotate the character and teleport the character. Thing is, the camera is able to freely move around and away the empty object. Making rotation seem like you're running in a circle instead of just rotating. Then when you teleport it's a little offset. Like if you shoot the teleport beam straight down you move because it's teleporting the empty object to the camera which moves the camera.
So if the headset and camera aren't exactly on top of the empty object everything gets wonky. I understand the problem just can't figure out a solution.
I tried resetting the position on every teleport but you can still move away and spin in circles. As well as resetting resets the orientation and that's not exactly what I need.
Any help would be greatly appreciated.
There's a few ways to approach this. A crude, and not very elegant solution would be to parent your camera parent to yet another object, created in runtime, that would assume the position of the actual player camera when the rotation starts. You can reparent objects dynamically, so you could rotate this newly spawned object, which would give you the desired effect, and then loose the top parent when the rotation stops.
Alternatively you could move your camera parent as you rotate it, based on transforming the position relative to the player camera position. A bit more elegant but there's probably a few lines of math that you would have to write
In my game the player running in forward direction on a path triggers the collider to instantiate the enemies, when the same player comes in opposite direction and triggers the collider i dont want the player to instantiate enemies. How to achieve this please help..
When I read your question, I see two possible situations here:
The player is only allowed to trigger when moving forward through it.
The player is only allowed to trigger when coming from a certain direction.
The first one would be quite easy. You can get the movement direction from the character controller to see if he's moving forward. You can for example try to use Transform.LookAt and compare it with the rotation of the player.
The second one is approached differently. For example, your trigger may only respond when the player moves forward along the x-axis. Then you record the X position as the very last thing in your movement loop. Then compare your X position in the next frame with the position in the last frame. If the difference between them is positive, you are moving in a positive direction. If negative, your moving in a negative direction.