B4i Library iSpriteKit- 2D game engine

Discussion in 'iOS Libraries' started by JanPRO, Feb 10, 2016.

  1. JanPRO

    JanPRO Well-Known Member Licensed User

    Name: iSpriteKit

    Version: 1.0.2

    Description: iSpriteKit is a wrapper of Apple's SpriteKit Framework which allows you to create 2D games.

    Notes/Tips:
    Download "iSpriteKit 1.02.zip": http://bit.ly/2fuueNo

    Please report bugs and other things which bothers you (maybe method names, descriptions etc.) to improve this library :)
     
    Last edited: Sep 25, 2017
    AndOrNot, paulgr, Mark Turney and 9 others like this.
  2. ilan

    ilan Expert Licensed User

    Wowwww thank you will try it out very soon :)
     
  3. tufanv

    tufanv Expert Licensed User

    You are awesome !!
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Thank you!

    The library is online.
     
    Mark Turney likes this.
  5. ilan

    ilan Expert Licensed User

    iSpriteKit is a huge addition to b4i.

    I tried your flappy clone example and it is working great.

    Thank you very much @JanPRO :)

    (if it is not to much work for you could you maybe put some comments in your flappy clone example?? And maybe use some audio files (background music + sounds)?? Thanks :))
     
  6. strat

    strat Active Member Licensed User

    On my Ipod Touch 5, this library didn't work. OS version is 8.4.1
    I opened and tested a new blank project, then, selected only iSprite from Libraries without adding any iSprite component into the Globals., app stopped working.
     
  7. Hypnos

    Hypnos Active Member Licensed User

    Thanks for your great work JanPRO!

    I tried your example on iPhone 6 and iPad3, it's working on iPhone but can't start on iPad 3, do you know the reason?
     
  8. JanPRO

    JanPRO Well-Known Member Licensed User

    Hi,
    thank you for the feedback :)

    @ilan
    In the next days I am going to improve the examples.

    @strat & @Hypnos
    The library uses features that are only supported by iOS 9+.
    Hypnos, please check the iOS version on your iPad.

    I recommend everbody to add the following line to the project:
    Code:
    #MinVersion: 9.0
     
    Erel, strat and ilan like this.
  9. John Sturt

    John Sturt Active Member Licensed User

    Hi Could this library be made to work with Voice Over enabled?
     
  10. JanPRO

    JanPRO Well-Known Member Licensed User

    Hi,
    I see the problem. I will check that ...

    Jan
     
  11. MallyUK

    MallyUK New Member Licensed User

    Are constraints working in this version? I've been trying to set a DistanceToPoint constraint (for a virtual joystick) but can't seem to get it to work.
     
  12. JanPRO

    JanPRO Well-Known Member Licensed User

    Can you post your code?
     
  13. ilan

    ilan Expert Licensed User

    hi @JanPRO

    can you please explain how to get the parameters from an UITouch? like position (x,y)

    in Sub GameScene_ToucheBegan (aTouch As Touch)

    thanx :)
     
  14. JanPRO

    JanPRO Well-Known Member Licensed User

    Hi,
    you can use the LocationInNode method of Touch.
    Note: the whole GameScene is a SKNode.

    Code:
    Sub GameScene_ToucheBegan (aTouch As Touch)
        
    Dim X As Float = aTouch.LocationInNode(GameScene).X
        
    Dim Y As Float = aTouch.LocationInNode(GameScene).Y
    End Sub
    Jan
     
    ilan likes this.
  15. MallyUK

    MallyUK New Member Licensed User

    I've tried loads of different ways to set a constraint, this is my last attempt.. but I still get an "Object was not initialized (NSArray)" error. I've tried using an array (as the apple docs suggest), a list, and like this.. where am I going wrong? :(

    Code:
    'Code module
    #Region  Project Attributes
        
    #ApplicationLabel: B4i Joystick
        
    #Version: 1.0.0
        
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
        #iPhoneOrientations: Portrait
        
    #iPadOrientations: Portrait
        
    #Target: iPhone
        
    #MinVersion: 9
        
    #PlistExtra: <key>UIViewControllerBasedStatusBarAppearance</key><false/>
    #End Region

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'Public variables can be accessed from all modules.
        Public App As Application
        
    Public NavControl As NavigationController
        
    Private Page1 As Page

        
    Private GameSize As Size
        
    Private GameView As SKView
        
    Private GameScene As SKScene
        
    Private sprNub As SKSpriteNode
        
    Private sprNubConstraint As SKConstraint
        
    Private newRange As SKRange
        
    Private nubX, nubY As Float
    End Sub

    Private Sub Application_Start (Nav As NavigationController)
        NavControl = Nav
        Page1.Initialize(
    "Page1")
        NavControl.ShowPage(Page1)
        Nav.NavigationBarVisible = 
    False

        
    'hide status bar
        Dim no As NativeObject = App
        no.RunMethod(
    "setStatusBarHidden:animated:"Array(TrueFalse))
            
    GameView.Initialize("GameView")
    End Sub

    Private Sub Page1_Resize(Width As Int, Height As Int)
        GameSize.Initialize(Width,Height)
        SetUpScene(GameSize)
        
    GameView.PresentScene(GameScene)
        Page1.RootPanel.AddView(
    GameView,0,0,Width,Height)
    End Sub

    Private Sub SetUpScene(aSize As Size) As SKScene

        GameScene.Initialize(
    "GameScene")
        GameScene.SceneWithSize(aSize)
        GameScene.ScaleMode = GameScene.SKSceneScaleModeAspectFill
        GameScene.BackgroundColor=
    Colors.Black
        
    Dim sprNubTex As SKTexture
        sprNubTex.TextureWithImageNamed(
    "redball.png")

        nubX = 
    100
        nubY = 
    100

        newRange.Initialize
        newRange.RangeWithUpperLimit(
    100)

        sprNubConstraint.Initialize
        sprNubConstraint.DistanceToPointInNode(newRange,CreatePoint(nubX,nubY), GameScene)

        sprNub.Initialize(
    "sprNub")
        sprNub.SpriteNodeWithTexture(sprNubTex)
        sprNub.Position=CreatePoint(nubX,nubY)
        sprNub.Constraints.Add(sprNubConstraint)
        GameScene.AddChild(sprNub)

    End Sub

    Sub GameScene_ToucheBegan (aTouch As Touch)

    End Sub

    Sub GameScene_ToucheMoved (aTouch As Touch)
        
    Dim TouchLocation As Point = aTouch.LocationInNode(GameScene)
        sprNub.Position = TouchLocation
    End Sub

    Sub GameScene_ToucheEnded (aTouch As Touch)
        
    Dim ska As SKAction
        ska.MoveTo(CreatePoint(nubY,nubX),
    .3)
        sprNub.RunAction(ska)
    End Sub

    Sub sprNub_TouchBegan (aTouch As Touch)

    End Sub

    Private Sub Application_Background

    End Sub

    Sub CreateRange(variancex As Float) As SKRange
        
    Dim aRange As SKRange
        aRange.RangeWithConstantValue(variancex)
        
    Return aRange
    End Sub

    Sub CreatePoint(X As Float, Y As Float) As Point
        
    Dim aPoint As Point
        aPoint.Initialize(X,Y)
        
    Return aPoint
    End Sub

    Sub CreateVector(Dx As Float,Dy As Float) As Vector
        
    Dim aVector As Vector
        aVector.Initialize(Dx,Dy)
        
    Return aVector
    End Sub

    Sub CreateSize(Width As Float, Height As Float) As Size
        
    Dim aSize As Size
        aSize.Initialize(Width,Height)
        
    Return aSize
    End Sub
     
    Last edited: May 28, 2016
  16. JanPRO

    JanPRO Well-Known Member Licensed User

    Hi,
    change this line
    Code:
    sprNub.Constraints.Add(sprNubConstraint)
    to
    Code:
    sprNub.Constraints = Array(sprNubConstraint)
    Jan
     
  17. MallyUK

    MallyUK New Member Licensed User

    Eureka! So near and yet so far :) Thank you JanPRO for you assistance, and for this brilliant library!
     
  18. ilan

    ilan Expert Licensed User

    hallo @JanPRO is it still a beta version? have u already updated the examples ? (sound,...)

    thanx :)
     
  19. JanPRO

    JanPRO Well-Known Member Licensed User

    Hi,
    Yes, it's still a beta, but you can submit an app with iSpriteKit without any problems.
    Currently my free time is very limited, but I know I have promised you to update the examples. I will try to do it this week :)

    Jan
     
    ilan likes this.
  20. ilan

    ilan Expert Licensed User

    Hi @JanPRO
    Sorry to ask again but could you find some time to update your examples? (Sound, comments)?

    Are you going to release a finished version of your lib or will it stay a beta?

    I really want to learn spritekit and make some great ios games but it is very difficult for me to understand your examples.

    Thank you , ilan :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice