@needshelpsoon,
If you think about committing murder you are not murderer. But watching violent movies and visualizing actually doing it makes it more likely that you will act if the situation presents itself to you and you have the opportunity to do it without others seeing you. Hope you get the analogy. Stay away from the medium that caused the unpleasant/pleasant thought to surface. take part in productive activities. Not activities that give you physical pleasure, but activities that create a feeling of emotional well being and puts your mind at ease. You don't need to fall prey to everything you are tempted to do. don't move opposite to your conscience or you will never be at peace.
If you have engaged in acts you are ashamed of that creates feelings of guilt pray about it, if you believe in God. If not I'll pray for you.
Have blessed day...