How to extract Tiles position to check with player`s position? - unity3d

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

Related

Unity 2D: Alter sprite anchor point

I've got a plain 2D Capsule Sprite. I want it to rotate around a specific point instead of its very centre. In other programs, this point is called the anchor point. For context, I'm making a paddle for my 2D pinball game so obviously the paddle needs to move when you press a button, but I can't have it moving around its very centre... Well, I could but I don't want to.
So my questions are:
Is anchor point the correct term for Unity?
Can this be altered/moved and how?
So, I ended up getting an idea from a friend who does this stuff too.
I made an empty game object. Made it the parent of my paddle. Moved the paddle to the point of the game object where I want the paddle to rotate around, and now when I rotate the game object, it rotates the paddle around the pivot point that I want it to have.
Image of paddle, arrow pointing to the empty game object
Edit: Just works using UI components within a canvas
You can use the Anchor presets of the Rect Transform. Or define the Min/Max values for x/y coordinates in Anchors Property.

How to align sprites of smaller sizes to a moving gameobject sprite?

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.

how to draw a line or play sprites on the path of the player unity2d

Im trying to make a game were you move the the end and were you moved spikes appear that kill you. I cant figure out draw line in unity2d. Are therer any ways that I could do this
Use OnCollisionEnter or OnTriggerEnter on either the tiles or player to detect when the player has touched a tile. Add a list to the player that contains every tile that has been touched. At the end when you want to spawn spikes, go through the list of every touched tile and spawn spikes at their locations.

How to create a gameobject that can move according to the coordinates of player

How to create a bot that can move according to the coordinates of the main player, repeating the whole position of the player.
I could not use movetoward. because I want the gameobject to redo the entire position of the player.
-- many thank.

Using CCParticleFire with CCFollow

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?