This script shows how to create a corona without using the opcode 04D5.
- Code:
{$CLEO}
0000:
:Check_01
while 80E1: not player 0 pressed_key 11
wait 0
end
0006: 32@ = 0
:Check_02
wait 0
if
0019: 32@ > 4000
then
jump @Check_01
end
for 0@ = 0 to 4
0093: 1@ = integer 0@ to_float
04C4: store_coords_to 2@ 3@ 4@ from_actor $PLAYER_ACTOR with_offset 0.0 1@ 0.0
0085: 31@ = 0@ // (int)
0012: 31@ *= -0x1F
000A: 31@ += @corona
gosub 31@
end
jump @Check_02
:corona
hex
D504030200030300030400060000803F0404040005FF0005FF0005FF005100
D504030200030300030400060000803F0404040005FF0005FF0005FF005100
D504030200030300030400060000803F0404040005FF0005FF0005FF005100
D504030200030300030400060000803F0404040005FF0005FF0005FF005100
D504030200030300030400060000803F0404040005FF0005FF0005FF005100
end
Obtain a vertical angle of the camera
These codes/scripts are used to obtain a vertical angle of the camera, perhaps these codes are a little hard to understand for the newbie scripter's, though if you have much experience then you should able to understand, if you have a long-good look at the codes. These codes are for people who know how to use them, (or want to learn), the codes use the then..else..end, method 1 uses the ATAN mathematics script, the second uses a sub-script.
Method 1:
- Code:
068D: get_camera_position_to 0@ 1@ 2@
068E: get_camera_target_point_to 3@ 4@ 5@
0509: 0@ = distance_between_XY 0@ 1@ and_XY 3@ 4@
0063: 5@ -= 2@ // (float)
0087: 1@ = 5@ // (float)
gosub @ATAN
000F: 2@ -= 270.0
//.......
:ATAN
0509: 2@ = distance_between_XY 0@ 1@ and_XY 0.0 0.0
0073: 0@ /= 2@ // (float)
0073: 1@ /= 2@ // (float)
0509: 2@ = distance_between_XY 0@ 1@ and_XY 0.0 1.0
for 3@ = 0 to 15
0017: 2@ /= 2.0
006B: 2@ *= 2@ // (float)
0087: 1@ = 2@ // (float)
0013: 2@ *= -1.0
000B: 2@ += 1.0
01FB: 2@ = square_root 2@
0013: 2@ *= -1.0
000B: 2@ += 1.0
006B: 2@ *= 2@ // (float)
005B: 2@ += 1@ // (float)
01FB: 2@ = square_root 2@
end
0013: 2@ *= 65536.0
0017: 2@ /= 3.14159265
0013: 2@ *= 180.0
if
0021: 0@ > 0.0
then
0013: 2@ *= -1.0
000B: 2@ += 360.0
end
return
Method 2:
- Code:
:ATAN
wait 3000
068D: get_camera_position_to 10@ 11@ 12@
068E: get_camera_target_point_to 27@ 28@ 29@
050A: 25@ = distance_between_XYZ 10@ 11@ 12@ and_XYZ 27@ 28@ 12@
050A: 24@ = distance_between_XYZ 27@ 28@ 12@ and_XYZ 27@ 28@ 29@
0013: 25@ *= 100.0
0013: 24@ *= 100.0
0073: 24@ /= 25@ // (float)
0013: 24@ *= 100.0
008E: 24@ = float 24@ to_integer
if
0025: 12@ > 29@ // (float)
then
0012: 24@ *= 0xFFFFFFFF
end
gosub @SubScript
045A: draw_text_1number 500.0 90.0 GXT 'NUMBER' number 0@ // degree draw
jump @ATAN
:SubScript
if
0029: 24@ >= 92
then
0007: 0@ = 45.0
jump @SubScript02
end
if and
001B: 92 > 24@
0029: 24@ >= 77
then
0007: 0@ = 40.0
jump @SubScript02
end
if and
001B: 77 > 24@
0029: 24@ >= 64
then
0007: 0@ = 35.0
jump @SubScript02
end
if and
001B: 64 > 24@
0029: 24@ >= 52
then
0007: 0@ = 30.0
jump @SubScript02
end
if and
001B: 52 > 24@
0029: 24@ >= 42
then
0007: 0@ = 25.0
jump @SubScript02
end
if and
001B: 42 > 24@
0029: 24@ >= 32
then
0007: 0@ = 20.0
jump @SubScript02
end
if and
001B: 32 > 24@
0029: 24@ >= 22
then
0007: 0@ = 15.0
jump @SubScript02
end
if and
001B: 22 > 24@
0029: 24@ >= 13
then
0007: 0@ = 10.0
jump @SubScript02
end
if and
001B: 13 > 24@
0029: 24@ >= 5
then
0007: 0@ = 5.0
jump @SubScript02
end
if and
001B: 5 > 24@
0029: 24@ >= -5
then
0007: 0@ = 0.0
jump @SubScript02
end
if and
001B: -5 > 24@
0029: 24@ >= -13
then
0007: 0@ = -5.0
jump @SubScript02
end
if and
001B: -13 > 24@
0029: 24@ >= -22
then
0007: 0@ = -10.0
jump @SubScript02
end
if and
001B: -22 > 24@
0029: 24@ >= -32
then
0007: 0@ = -15.0
jump @SubScript02
end
if and
001B: -32 > 24@
0029: 24@ >= -42
then
0007: 0@ = -20.0
jump @SubScript02
end
if and
001B: -42 > 24@
0029: 24@ >= -52
then
0007: 0@ = -25.0
jump @SubScript02
end
if and
001B: -52 > 24@
0029: 24@ >= -64
then
0007: 0@ = -30.0
jump @SubScript02
end
if and
001B: -64 > 24@
0029: 24@ >= -77
then
0007: 0@ = -35.0
jump @SubScript02
end
if and
001B: -77 > 24@
0029: 24@ >= -92
then
0007: 0@ = -40.0
jump @SubScript02
end
if and
001B: -92 > 24@
0029: 24@ >= -110
then
0007: 0@ = -45.0
jump @SubScript02
end
if and
001B: -110 > 24@
0029: 24@ >= -131
then
0007: 0@ = -50.0
jump @SubScript02
end
if and
001B: -131 > 24@
0029: 24@ >= -158
then
0007: 0@ = -55.0
jump @SubScript02
end
if and
001B: -158 > 24@
0029: 24@ >= -194
then
0007: 0@ = -60.0
jump @SubScript02
end
if and
001B: -194 > 24@
0029: 24@ >= -244
then
0007: 0@ = -65.0
jump @SubScript02
end
if and
001B: -244 > 24@
0029: 24@ >= -324
then
0007: 0@ = -70.0
jump @SubScript02
end
if and
001B: -324 > 24@
0029: 24@ >= -471
then
0007: 0@ = -75.0
jump @SubScript02
end
if and
001B: -471 > 24@
0029: 24@ >= -860
then
0007: 0@ = -80.0
jump @SubScript02
end
if and
001B: -860 > 24@
0029: 24@ >= -5575
then
0007: 0@ = -85.0
jump @SubScript02
end
if
001B: -5575 > 24@
then
0007: 0@ = -90.0
jump @SubScript02
end
:SubScript02
if
0023: 0.0 > 0@
then
000B: 0@ += 360.0
end
008E: 0@ = float 0@ to_integer
return