Flashindo Academy
Selamat datang di Flashindo Academy, akademi pembuat Flash :wave:
Di sini Anda bisa berbagi proyek/karya Flash-mu dan lain-lain disini :)

Ayo langsung join :D dan akun langsung aktif lho.. :-
Flashindo Academy
Selamat datang di Flashindo Academy, akademi pembuat Flash :wave:
Di sini Anda bisa berbagi proyek/karya Flash-mu dan lain-lain disini :)

Ayo langsung join :D dan akun langsung aktif lho.. :-
Flashindo Academy
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Akademi Pembuat Flash
 
HomeTata TertibLatest imagesSearchRegisterLog in

 

 [GML] Projectile Launch Aiming Finder

Go down 
2 posters
AuthorMessage
ListRA-92
The Headmaster
ListRA-92


Posts : 93
Cash : 394
Appreciations : 0
Location : antara ada dan tiada~ :-
Jenjang Pendidikan : Kuliah
Join date : 2010-10-15
Status : ADT Listra Linier Berkait :hammer:

[GML] Projectile Launch Aiming Finder Empty
PostSubject: [GML] Projectile Launch Aiming Finder   [GML] Projectile Launch Aiming Finder EmptySun Oct 31, 2010 9:10 pm

Overview:

Script: parabola
Code:
/*
parabola: (x0,y0,x1,y1) -> (theta,v0)

Computes launch speed of the projectile (v0) with randomly given elevation
angle (theta), for known the launcher coordinate (x0,y0) and the target
coordinate (x1,y1); in case of no forces applied but the constant gravity.
*/
x0=argument0
y1=argument1
x1=argument2
y0=argument3
g=XXX //Replace with a reasonable value
theta=pi/2-random(pi/2-arctan((y1-y0)/(x1-x0)))
v0=(x1-x0)/cos(theta)*sqrt(.5*g/((x1-x0)*tan(theta)-(y1-y0)))

Script: parabola2
Code:
/*
parabola2: (x0,y0,x1,y1,ax,ay) -> (theta,v0)

Computes launch speed of the projectile (v0) with randomly given elevation
angle (theta), for known the launcher coordinate (x0,y0), the target
coordinate (x1,y1), and x-component and y-component of wind acceleration;
in case of no another forces applied.
*/
x0=argument0
y1=argument1
x1=argument2
y0=argument3
ax=argument4
ay=argument5
g=XXX //Replace with a reasonable value
do{
    theta=random(pi/2)
    k=((y1-y0)/(x1-x0)-(ay-g)/ax)/(sin(theta)-(ay-g)/ax*cos(theta))
}until(ax*(x1-x0)/(1-k*cos(theta))>=0)
v0=k*sqrt(.5*ax*(x1-x0)/(1-k*cos(theta)))

Fungsi: menghitung laju luncur peluru (v0) dan sudut elevasi (theta) agar peluru dapat mengenai target dengan tepat

Deskripsi script:
- parabola: menghitung laju luncur peluru (v0) dan sudut elevasi (theta), dalam kasus hanya gaya gravitasi yang bekerja pada peluru
- parabola2: menghitung laju luncur peluru (v0) dan sudut elevasi (theta), dengan besar dan arah percepatan angin yang juga bekerja pada peluru, selain gaya gravitasi

Cara pemasangan:
- Buat salah satu script baru: parabola atau parabola2
- Copas bagian code di atas ke masing2 script tersebut
- Implementasikan script tersebut ke action Execute a piece of code pada Event saat peluru akan dibuat (diluncurkan).
- Pada peluru yang diluncurkan, set speed=v0, direction=radtodeg(theta). Set gravity=g, jika menggunakan parabola (kasus tidak ada angin), atau set gravity=point_distance(0,0,ax,ay-g) dan gravity_direction=point_direction(0,0,ax,ay-g).

Created by: Listra the Gunmanner
Back to top Go down
https://flashindo.rpg-board.net
sai_sora
Dora The Explorer
sai_sora


Posts : 59
Cash : 66
Appreciations : 0
Age : 26
Location : mana aja bisa
Jenjang Pendidikan : SMP
Join date : 2010-10-20
Status : apayaa

[GML] Projectile Launch Aiming Finder Empty
PostSubject: Re: [GML] Projectile Launch Aiming Finder   [GML] Projectile Launch Aiming Finder EmptyWed Nov 03, 2010 9:27 pm

makasih infonya
Back to top Go down
 
[GML] Projectile Launch Aiming Finder
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Flashindo Academy :: Education Class :: Programming :: Scripts Lounge-
Jump to: