Games Space Shooter Image Assignment

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.
 

Erel

Administrator
Staff member
Licensed User


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

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

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.
 

ElliotHC

Active Member
Licensed User
Does anyone know how to make the Object from image file without using the TileMap?
 

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:
Top