Forums »
Modding » Zarkonnen, a couple questions about shots/projectiles...
Zarkonnen, a couple questions about shots/projectiles...
Want to participate?
Register an account.
Forums »
Modding » Zarkonnen, a couple questions about shots/projectiles...
Lieutenant, Engineering Corps
Hi Zarkonnen,
I'm currently trying to implement new projectile types: Guided Projectiles & Beams. I feeling a little bit lost here. Can you please point me to the right classes/methods, which are responsible for launching projectile from the weapon, after all required information (such as speed, trail size, image & etc) were already received and processed?
Commander, Engineering Corps
Hah, NetBeans remembered what .java files were last opened even with upgrading to Windows10
With my utter lack of understanding of anything apart from trial and error.
.shotSpeed(1.2) // Speed of projectile, assuming 1 = 1 tile per second/tick?
.shot(new Img("spritesheet", 64, 304, 1, 1, false)) // Co-Ords, size, ?
.exhaust(new WeaponAppearance.ShotExhaustEmitter(Type.GRENADE_SPARK, 0.01, 1, Math.PI, 1, 0.5, 1)) // Types are defined in .partical.java, donno how that works. First values were for frequency and length (I think), Math Values = lower makes it more tame, higher more energetic
Donno if that helps at all..
Aerial Emperor
Sure, basically most of what you need will be in Shot.java. Weapons create new Shots by adding them to the combat.
Lieutenant, Engineering Corps
Zarkonnen, and d.blit in draw(Draw d) in Shot.java is responsible for showing/rendering where exactly is projectile itself in current "tick" - right?
Aerial Emperor
Yep, and the
lines after it calculate the x-position, y-position and rotation on the basis of where the shot started from, is going, and how long it's travelled.
So if you want to make guided missiles you probably want to change how shots' positions are stored, giving them a current x/y coordinate you can then modify, etc.
Lieutenant, Engineering Corps
Thanks! Also, can you please point me to the method that is responsible for rotating the gun/barrel towards the target?
EDIT: I think weaponAngle = Direction.radiansFromTo(sX, sY, target.b.x, target.b.y) from public boolean fire(Combat c) at Module.java is responsible for it. Please correct me, if I'm wrong.