Android Question Tower Defence game questions

coldteam

Active Member
Licensed User
Longtime User
Hello! Do TowerDefence game. There are a few issues. I need your help.
Use LibGDX
1. I create monsters like this:

B4X:
Dim img_monster As lgTexture
Type typeMonster(x As Float, y As Float,HP As Int,SPEED As Int)
Dim Monster As typeMonster
Dim Monster_Region As lgTextureRegion

img_monster.Initialize("monster.png")
Monster_Region.InitializeWithTexture(img_monster)

....
Sub LG_Render
....
Batch.DrawRegion2(Monster_Region,Monster.x,Monster.y,width,height)
....

question:
how to track a collision this objects?

2.
want the area around the tower, when the monster comes into the area, the tower begins to shoot

here, too, you need to keep track of the collision? how?

3.
shooting
if Rocket flies in a moving target, how to calculate the next coordinates to move the rocket


4.
how to control what is to be the foreground and the background

 

ilan

Expert
Licensed User
Longtime User
its work fine, but if i try to do it with lgMathVector2, its dont work

if you set the vector to a variable after you change that variable and then check if both are the same then they MUST be the same otherwise you do something wrong.

you can check it:

B4X:
dim vec2 as lgMathVector2
dim x, y as float

x = 100
y = 100

vec2.set(x,y)

log(vec2.x=x)
log(ver2.y=y)

you should get 2 TRUE in the logs.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…