@vladaboy93
Sta radi tvoj "inteligentan neprijatelj" kad dodje do sudara sa tobom? Najelegantnije resenje bi bilo da za uvedes izuzetak kada dodje do sudara sa neprijateljem. Jos treba da vodis racuna da posle sudara moze da se krece samo na pravcu na kom je vec bio (u istom ili suprotnom smeru).
npr:
Sta radi tvoj "inteligentan neprijatelj" kad dodje do sudara sa tobom? Najelegantnije resenje bi bilo da za
Citat:
pre svakog key pressa testira da li je moj tenk snapovan na grid (40,40)
npr:
Code:
Collision Event with object neprijatelj:
if abs(hspeed) is larger than 0
set variable izuzetak to 1
if abs(vspeed) is larger than 0
set variable izuzetak to 2
set variable speed to 0
Key Press Event for <Left> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the horizontal speed to -4
if izuzetak is equal to 1
set the horizontal speed to -4
set variable izuzetak to 0
Key Press Event for <Up> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the vertical speed to -4
if izuzetak is equal to 2
set the horizontal speed to -4
set variable izuzetak to 0
Key Press Event for <Right> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the horizontal speed to 4
if izuzetak is equal to 1
set the horizontal speed to 4
set variable izuzetak to 0
Key Press Event for <Down> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the vertical speed to 4
if izuzetak is equal to 2
set the horizontal speed to 4
set variable izuzetak to 0
Collision Event with object neprijatelj:
if abs(hspeed) is larger than 0
set variable izuzetak to 1
if abs(vspeed) is larger than 0
set variable izuzetak to 2
set variable speed to 0
Key Press Event for <Left> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the horizontal speed to -4
if izuzetak is equal to 1
set the horizontal speed to -4
set variable izuzetak to 0
Key Press Event for <Up> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the vertical speed to -4
if izuzetak is equal to 2
set the horizontal speed to -4
set variable izuzetak to 0
Key Press Event for <Right> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the horizontal speed to 4
if izuzetak is equal to 1
set the horizontal speed to 4
set variable izuzetak to 0
Key Press Event for <Down> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the vertical speed to 4
if izuzetak is equal to 2
set the horizontal speed to 4
set variable izuzetak to 0


