skshapenode

SKSharp not loading Bitmap Xamarin Forms

蹲街弑〆低调 提交于 2021-01-29 07:07:19
问题 I'm trying to load "png's" into a ListView in a XamarinForms app using Android and UWP projects. Here is my xaml of the ListView. <ListView x:Name="TemplateListView" ItemsSource="{Binding TemplateData}"> <ListView.ItemTemplate> <DataTemplate> <StackLayout Orientation="Vertical"> <Image Margin="20,0,0,0" Source="{Binding ImageData}" Aspect="AspectFit" HeightRequest="120"></Image> <Label Text="{Binding Title}" FontSize="16" /> </StackLayout> </DataTemplate> </ListView.ItemTemplate> </ListView>

Drawing dashed line in Sprite Kit using SKShapeNode

萝らか妹 提交于 2020-05-27 05:02:31
问题 I fount this solution but I can't make it into swift code This what I try var pattern[2]:CGFloat; this var dashed: CGPathRef = CGPathCreateCopyByDashingPath(CGPathCreateCopyByDashingPath(path, transform, phase, lengths, count); var myShapeNode: SKShapeNode!; var CGPathCreateCopyByDashingPath:CGPathRef; 回答1: This is how you can draw a dashed line in swift. You can change the parameters as you want. let bezierPath = UIBezierPath() let startPoint = CGPointMake(0, 250) let endPoint = CGPointMake

Spritekit layout lags when device orientation changes

让人想犯罪 __ 提交于 2020-03-06 09:19:13
问题 Ok, this might be a bit hard to explain since I can't include any video to show you what I mean, but I'll give it a shot. I have added a SKShapeNode to a scene and when I rotate the device orientation it follows along nicely as expected, positioning itself in the upper left side of the screen whichever way the device is rotated. But the SKShapeNode "lags" behind, that is, when I rotate to a new orientation, the node remain in the same position for half a second before it is relocated to the

Confusion about coordinates, frames & child nodes in SpriteKit on iOS?

╄→尐↘猪︶ㄣ 提交于 2020-01-02 02:42:07
问题 I'm still playing around with learning SpriteKit in iOS & have been doing lots of reading & lots of experimenting. I'm confused by something else I've found* regarding coordinates, frames & child nodes. Consider this snippet of code, in which I'm trying to draw a green box around my spaceship sprite for debugging purposes: func addSpaceship() { let spaceship = SKSpriteNode.init(imageNamed: "rocketship.png") spaceship.name = "spaceship" // VERSION 1 spaceship.position = CGPointMake

Create \(Use) SKView as \(in a) factory \(static class)

≯℡__Kan透↙ 提交于 2019-12-29 08:26:17
问题 I want to make an SKView I can use as a factory to make SKShapeNodes and "render" them to textures. But I can't find how I would initialise such a thing, and am having no luck, at all. How do I make a standalone SKView for this purpose? Or is there a better way to do this that avoids using the gamescene? Here's my FUTILE Effort at making a factory, this complains that texture(from: ) is ambiguous . I have no idea what that means. import SpriteKit class Make: SKView{ static func circle() ->

Create \(Use) SKView as \(in a) factory \(static class)

若如初见. 提交于 2019-12-29 08:26:09
问题 I want to make an SKView I can use as a factory to make SKShapeNodes and "render" them to textures. But I can't find how I would initialise such a thing, and am having no luck, at all. How do I make a standalone SKView for this purpose? Or is there a better way to do this that avoids using the gamescene? Here's my FUTILE Effort at making a factory, this complains that texture(from: ) is ambiguous . I have no idea what that means. import SpriteKit class Make: SKView{ static func circle() ->

skphysicsbody collision between two same nodes

烈酒焚心 提交于 2019-12-24 23:07:08
问题 I created a class that declare a ball of kind 'SKShapeNode'. in its init I set the 'SKPhysicsBody' properties. before I set these properties (leave it as default) when one ball touch another one the both affected by the touch (like: move to different position depends on the collision position). after I set the 'physicsBody' properties it won't affected any more - one ball appear to be above the other one (like frame on frame - hiding it). how can I set this property? I look at apple doc and

Keep relative positions of SKSpriteNode from SKShapeNode from CGPath

混江龙づ霸主 提交于 2019-12-24 00:46:44
问题 I have an array of array of coordinates (from a shapefile), which I'm trying to make into a series of SKSpriteNodes. My problem is that I need to keep the relative positions of each of the shapes in the array. If I use SKShapeNodes, it works, as they are just created directly from the path I trace, but their resources consumption is quite high, and, in particular I cannot use lighting effects on them. If I use SKSpriteNodes with a texture created from the shape node, then I lose their

How to draw a hollow circle with two different colors?

我们两清 提交于 2019-12-24 00:30:55
问题 Im very familiar with drawing a filled createEllipseInRect shape node, but I was wondering if there's a way to do this programmatically. I want a circle thats split through the center with two separate colors on either side. I don't have code since I have no idea where to start with this. something like this Help much appreciated. 回答1: You can try using SKCropNode, this allows you to show only half of each circle. See below code for example of this. class GameScene: SKScene { override func

Set SKShapeNode frame to calculateAccumutedFrame

早过忘川 提交于 2019-12-22 12:33:26
问题 This issue has been happening for days: I cannot set the specific frame I need. I need my SKShapeNode frame to be the bounding box around a circle so that it is an inscribed circle to the frame. The blue is the current frame and the red is the frame I want it to be. I am creating the SKShapeNode like this: init(level: Int, from: SKSpriteNode, fromScene: GameScene) { self.level = level self.from = from self.fromScene = fromScene bezierPath = UIBezierPath(arcCenter: CGPoint.zero, radius: