1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Games Space Shooter Image Assignment

Discussion in 'Game Development' started by ElliotHC, Apr 11, 2019.

  1. ElliotHC

    ElliotHC Active Member Licensed User

    How is the gold_bolt.png in Space Shooter called? I want to replace that with another image but I can't see anywhere where it is assigned to the game or called.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    Open space shooter.json with Tiled. Most of the bodies are declared there.
     
  3. ElliotHC

    ElliotHC Active Member Licensed User

    Thanks but where and how do I open/display that window?
     
  4. Gunther

    Gunther Active Member Licensed User

    This is the screenshot of a program called Tiled. It is not part of the B4X IDE. Do a Google search and download the program for free

    The JSON file is located in the shared folder normally.
     
    ElliotHC likes this.
  5. ElliotHC

    ElliotHC Active Member Licensed User

    Thanks.

    Does anyone know how I could instead as each power is created, call it from file.. For example:


    Private Sub CreatePowerUp (gs As X2GameStep)
    Dim powerbody As X2BodyWrapper = TileMap.CreateObject2ByName(ObjectLayer, "power")
    powerbody.Body.SetTransform(X2.CreateVec2(X2.RndFloat(WorldWidth * PositionA, WorldWidth * PositionB), WorldHeight), 0)
    powerbody.Body.LinearVelocity = X2.CreateVec2(0, -4)' X2.RndFloat(-6, -2))
    End Sub

    Private Sub CreatePowerUp (gs As X2GameStep)
    Dim powerbody As "IMAGE FROM FILE HERE"
    powerbody.Body.SetTransform(X2.CreateVec2(X2.RndFloat(WorldWidth * PositionA, WorldWidth * PositionB), WorldHeight), 0)
    powerbody.Body.LinearVelocity = X2.CreateVec2(0, -4)' X2.RndFloat(-6, -2))
    End Sub

    Ideally set the size too.
     
  6. ElliotHC

    ElliotHC Active Member Licensed User

    Does anyone know how to make the Object from image file without using the TileMap?
     
  7. Gunther

    Gunther Active Member Licensed User

    Please have a look at the Monster Truck example and check for the box shape below the truck.
    This brings you on the right way. And as I remember right in Ilan's example the balls were created by code as well. At least in Erels last modification.
     
    Last edited: Apr 12, 2019
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