Positioning of Analog


I’m facing a hard time to position my analog to the right bottom corner in the scene i’m following my book ( IOS Games by Tutorial ) but it’s showing just how to position it in the left bottom can any one help me Plz …

Thanks and regards

What do you mean by your “analog”? Are you trying to position a sprite in sprite kit?

Have you defined its anchor point? Is it the center of the sprite or the bottom left edge?

yes I’m trying to position a sprite but I don’t know how this is a Pic

i won’t to change the position for the analog from the Left bottom to the Right bottom
how can I and this is my code:

let padSide: CGFloat = view.frame.size.height / 2.5
let padPadding: CGFloat = view.frame.size.height / 32
analogControl = AnalogControl(frame: CGRectMake(padPadding, skView.frame.size.height - padPadding - padSide, padSide, padSide))

Regards …

You mean your Analog Joystick sprite? Although i think that qualifies as a digital joystick :slightly_smiling:
What you need is to get the frame’s width because you want to move it from left to right. What happens when you use your current code?

i tried to get frame’s width but the analog disappear any idea…?


Have you tried logging your values to make sure they are what you think they are? In other words, log the width and height of the frame.

yes i tried it’s the same nothing happened

@treke Please upload your project and I’ll take a look.

It’s ok Man ty i do it :blush: