How to move points of a CGPathRef - objective-c

I am making a game where the player can draw a line with their finger, except I would like to show movement in the game. I have it so that when the player moves their finger it draws as if you were drawing on a piece of paper. However I want it to act more as if you were walking down a sidewalk and drawing side to side on it with a piece of chalk while moving. As the game goes on I would like the rest of the line to trail to the bottom of the screen while drawing. Thanks!

Related

Why is it that when the ball touches the goalie the backdrop(background) does not change to game over background?

Ball Movement Code:
Goalie Movement Code:
The code was working before, however it is not working now.
I tried to rework my code change my blocks for when the ball touches the goalie to send a message to the goalie and the goalie to send a message to change the backdrop(background) to game over backdrop.
According to the screenshots, it's possible you are not calling Ball Movement.
To improve your code, make it so that the soccer ball does not have the "When background switches to Game Over", since there is already a function in the same sprite that changes background.
Put the code in the ball sprite that is under "When background switches to Game Over " inside the "if touching goalie" statement.
100% Make sure you're calling ball movement in a forever loop under its own green flag clicked.

SKShapeNode with SKAction touch end when moves away from touch location

I'm currently making a very simple game to test out the Swift language from Apple, so far so good but I'm stuck with a touchesBegan and touchesEnded events while the SKShapeNode is animating away from the touch location.
The flow is this
Circles are animating around randomly
I touch one of them and it sets it to active
if the circle moves away from that touch it should become inactive
touchesEnded should fire as usual but also when the node moves away/out of the touch location
And I can't think of a way to do this, any help?
First of all, you have to include the code instead of just describing it.
An SKNode (or it's subclasses) do not lose a touch delegated to them even when it moves out of their apparent range. You will actually have to calculate the distance of the touch from the node's centre yourself in the -touchesMoved method and cancel the touch if it passes beyond a range you specify.

Custom NSCursor blinks with a black quad

I added NSTrackingArea to my view to capture mouseEntered/mouseExited events. It works. Then, when mouseEntered event gets captured I do
[self.window invalidateCursorRectsForView:self];
And in - (void)resetCursorRects method I draw image, create NSCursor from it and then:
[self addCursorRect:self.bounds cursor:myCursor];
It looks like working good, but sometimes, when dragging mouse (mouse down and dragged) over view cursor blinks (under the cursor appears some mysterious black quad, wich's size perfectly fits my cursor size. Only my cursor is circle. By the way that problem doesn't appears if my cursor is small. When ever it gets bigger it starts blinking. And it doesn't appears while no other drawings is being done at the same time.
What could be the problem?
Screens:
good moment:
bad moment:
Because my NSView was NSOpenGLView, I had to delete glClear(GL_COLOR_BUFFER_BIT) line, because while doing glClear it argues with alpha values.

Scrolling Scene in cocos2d

I have a sprite which moves across the screen.so i want to switch between the scenes.how can i do that.i am not interested in using Tile Map.I want just like angry birds scene scrolling.
Any Idea,
Thanks
If i understand what your asking you could just add everything to a cclayer and have everything as a child of it and move the full layer left or right to scroll
As glogic says, create a CCLayer and then add a CCSprite to it with an image much larger than the screen size.
Now in your touch handling code, do something like this...
OnTouchBegin - store position of the touch
OnTouchMoved - calculate distance from stored position where touch started and move the whole layer by that much.
OnTouchEnd - If your sprite has move too far and you have gone off the edge of the sprite, slide it back to the edge

Animate the drawing of a line (Quartz 2D?)

How would you go about animating the drawing of a line in a UIView on the iPhone? Is this possible? It can be drawn but can it easily be animated so it appears to be hand drawn?
There's no built-in way to do this no. You'd have to redraw the line repeatedly, interpolating between the start and end points using a timer callback to invalidate the view and trigger a redraw. Of course the redraw would have to draw everything in the area of the view bring redrawn which is potentially slow.
What I would do if I had a series of lines I wanted to draw over a period of time is to have two subviews - they would cover the same area and the top one would have a transparent background. Have the top one draw just the line that I am currently animating and when it's finished, draw the full length of it in the lower view. Then repeat, animating the next line in the top view.
With the new API you can do that easily, using strokeEnd property of CGPath.
You can read more details here: What's the easiest way to animate a line?