Funktion rausnehmen und einfügen
Hi, leute. Ich hab hier etwas schwieriges zu tun: Also ich hätte gern dass man aus diesem Pixelmovement ALLE Funktionen außer die Minimap raus nimmt (weil des ne extrem gute Minimap is und ich in der SuFu keine so gute gesehen hab) und hätte gern dass man die Minimap dan Kriegnebelfähigmacht (also halt wenn des Kriegsnebelscript drin is das halt der fog und so auf der Minimap angezeigt wird sollte aber auch gehen ohne dass man den Kriegsnebel eingebaut hat)
Kriegsnebel:
Pixelmovement:
Kriegsnebel:
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
#==============================================================================
# ** Fog of War begleit Scribt für Dynamic Maps
#------------------------------------------------------------------------------
# Version 2.0, 2005-11-21
# by Wachunga
#------------------------------------------------------------------------------
# filename of the fog of war autotile (used for both):
FOW_AT_NAME = 'fow_default'
# the opacity of static (non-returning) and dynamic (returning) fog of war
# (value between 0 and 255)
# note that static fow appears on top of its dynamic counterpart (if both on)
FOW_STATIC_OPACITY = 255
FOW_DYNAMIC_OPACITY = 100
# whether or not dynamic fow hides map events
FOW_DYNAMIC_HIDES_EVENTS = true
# default range of fog of war (if not specified in map name)
FOW_RANGE_DEFAULT = 3
#------------------------------------------------------------------------------
# internal constants - no need to edit
FOW = 0b00
REVEALED = 0b01
# tiles with no surrounding fog are flagged "SKIP" for efficiency
SKIP = 0b10
#------------------------------------------------------------------------------
=begin
Setup fog of war.
This method is an alternative to using the default map name method, and
is designed to be called from a call script event command. This allows
fog of war to be dynamically enabled or disabled during gameplay.
Parameters:
static - if true, static fow enabled
dynamic - if true, dynamic fow enabled
(if both of the above are false, fow is totally disabled)
range (optional) - the visual range of the player
* default is FOW_RANGE_DEFAULT
reset (optional) - if true, fow for this map resets entirely (i.e. previously
explored areas are covered again)
* default is false
Sample calls:
fog_of_war(true,true,5) - enable both static and dynamic fow with range of 5
fog_of_war(false,false,3,true) - disable and reset both types of fow
=end
def fog_of_war(static, dynamic, range = FOW_RANGE_DEFAULT, reset = false)
if static == nil or dynamic == nil
print 'Two true/false parameters are required in call to fog_of_war.'
exit
elsif range < 0 or range > 9
print 'Invalid range in call to fog_of_war (only 0-9 is valid).'
exit
end
$game_map.fow_static = static
$game_map.fow_dynamic = dynamic
$game_map.fow_range = range
if reset
$game_map.fow_grid = nil
end
if not $game_map.fow_static and not $game_map.fow_dynamic
$game_map.fow = false
$scene.spriteset.fow_tilemap.dispose
# set all events back to visible
for i in $game_map.events.keys
$game_map.events[i].transparent = false
end
else
# static or dynamic fow (or both) are on
$game_map.fow = true
if $game_map.fow_grid == nil # only if not already defined
$game_map.fow_grid = Table.new($game_map.width, $game_map.height, 2)
for i in 0...$game_map.fow_grid.xsize
for j in 0...$game_map.fow_grid.ysize
$game_map.fow_grid[i,j,1] = $game_map.fow_grid[i,j,0] = FOW
end
end
end
if $game_map.fow_dynamic
$game_map.fow_revealed = $game_map.fow_last_revealed = []
end
$scene.spriteset.initialize_fow
end
end
class Game_Map
attr_accessor :fow
attr_accessor :fow_static
attr_accessor :fow_dynamic
attr_accessor :fow_grid
attr_accessor :fow_range
attr_accessor :fow_revealed
attr_accessor :fow_last_revealed
alias wachunga_fow_gm_setup setup
def setup(map_id)
wachunga_fow_gm_setup(map_id)
@fow = false
@fow_dynamic = false
@fow_static = false
@fow_grid = nil
@fow_range = nil
# get any tags from the map name
tags = $game_map.map_name.delete(' ').scan(/<[A-Za-z0-9_.,]+>/)
if not tags.empty? and tags[0].upcase == ('<FOW>')
tags.shift # remove FOW tag
@fow = true
if @fow_grid == nil # only if not already defined
@fow_grid = Table.new(@map.width, @map.height, 2)
for i in 0...@fow_grid.xsize
for j in 0...@fow_grid.ysize
@fow_grid[i,j,1] = @fow_grid[i,j,0] = FOW
end
end
end
# check if types of fog of war specified
while not tags.empty?
case tags[0].upcase
when '<S>'
@fow_static = true
when '<D>'
@fow_dynamic = true
else
x = tags[0].delete('<>').to_i
@fow_range = x if x >= 0 and x <= 9
end
tags.shift
end
# if <FOW> tag found but neither static nor dynamic specified, assume both
if @fow and not @fow_static and not @fow_dynamic
@fow_static = true
@fow_dynamic = true
end
# if no range specified, set to default
if @fow_range == nil
@fow_range = FOW_RANGE_DEFAULT
end
@fow_revealed = @fow_last_revealed = [] if @fow_dynamic
end
end
def map_name
return load_data('Data/MapInfos.rxdata')[@map_id].name
end
=begin
Updates the map's grid which keeps track of one or both of the following
(depending on what is enabled for the current map):
1) which tiles have been "discovered" (i.e. no static fog of war) based on
where the player has already explored
2) which tiles are currently not covered by dynamic fog of war (i.e. not in
visual range)
=end
def update_fow_grid
px = $game_player.x
py = $game_player.y
x = px - @fow_range
start_y = py
y = start_y
count = 1
mod = 1
# loop through all tiles in visible range
until x == (px + @fow_range+1)
i = count
while i > 0
if valid?(x,y)
if @fow_static
@fow_grid[x,y,1] |= REVEALED
end
if @fow_dynamic
@fow_grid[x,y,0] = REVEALED if @fow_grid[x,y,0] == FOW
@fow_revealed.push([x,y])
end
end
y -= 1
i -= 1
end
if x == px
mod = -1
end
x += 1
start_y += 1*mod
y = start_y
count += 2*mod
end
if @fow_dynamic
if @fow_last_revealed != []
# make dynamic fog return once out of visual range
for t in @fow_last_revealed - @fow_revealed
@fow_grid[t[0],t[1],0] = FOW
end
end
@fow_last_revealed = @fow_revealed
@fow_revealed = []
end
end
end
#------------------------------------------------------------------------------
class Spriteset_Map
attr_reader :fow_tilemap
alias wachunga_fow_ssm_initialize initialize
def initialize
initialize_fow if $game_map.fow
wachunga_fow_ssm_initialize
end
=begin
Initializes fog of war.
=end
def initialize_fow
@fow_tilemap = Tilemap.new
@fow_tilemap.map_data = Table.new($game_map.width, $game_map.height, 3)
@fow_tilemap.priorities = Table.new(144)
@fow_autotiles = Hash.new(0)
j = 48 # starting autotile index
for i in Autotile_Keys
@fow_autotiles[i] = j
j += 1
end
# add duplicates
for i in Duplicate_Keys.keys
@fow_autotiles[i] = @fow_autotiles[Duplicate_Keys[i]]
end
if $game_map.fow_static
for m in 0...$game_map.fow_grid.xsize
for n in 0...$game_map.fow_grid.ysize
# reset SKIP flag
$game_map.fow_grid[m,n,1] &= ~SKIP
end
end
at = Bitmap.new(96,128)
at.blt(0,0,RPG::Cache.autotile(FOW_AT_NAME),\
Rect.new(0,0,96,128),FOW_STATIC_OPACITY)
@fow_tilemap.autotiles[0] = at
# set everything to fog
for x in 0...$game_map.width
for y in 0...$game_map.height
@fow_tilemap.map_data[x,y,2] = 48 # fog
end
end
# set to highest priority
for i in 48...96
@fow_tilemap.priorities[i] = 5
end
end
if $game_map.fow_dynamic
bm = Bitmap.new(96,128)
bm.blt(0,0,RPG::Cache.autotile(FOW_AT_NAME),\
Rect.new(0,0,96,128),FOW_DYNAMIC_OPACITY)
@fow_tilemap.autotiles[1] = bm
# unlike tilemap for static, set everything to clear
for x in 0...$game_map.width
for y in 0...$game_map.height
@fow_tilemap.map_data[x,y,1] = 0
end
end
# set to highest priority
for i in 96...144
@fow_tilemap.priorities[i] = 5
end
end
$game_map.update_fow_grid
update_fow_tilemap
update_event_transparency if $game_map.fow_dynamic
end
=begin
Updates the (static and/or dynamic) fog of war tilemap based on the map's
underlying grid.
=end
def update_fow_tilemap
if $game_map.fow_static
checked = Table.new($game_map.width,$game_map.height)
for j in 0...$game_map.width
for k in 0...$game_map.height
checked[j,k] = 0
end
end
end
dx = ($game_map.display_x/128).round
dy = ($game_map.display_y/128).round
# to increase performance, only process fow currently on the screen
for x in dx-1 .. dx+21
for y in dy-1 .. dy+16
# check boundaries
if not $game_map.valid?(x,y) then next end
if $game_map.fow_dynamic
if $game_map.fow_grid[x,y,0] == REVEALED
@fow_tilemap.map_data[x,y,1] = 0 if @fow_tilemap.map_data[x,y,1]!=0
else
@fow_tilemap.map_data[x,y,1]=96 if @fow_tilemap.map_data[x,y,1]!=96
end
end
if $game_map.fow_static
if $game_map.fow_grid[x,y,1] == REVEALED # (but not SKIP)
others = false;
@fow_tilemap.map_data[x,y,2] = 0 if @fow_tilemap.map_data[x,y,2]!=0
for i in x-1 .. x+1
for j in y-1 .. y+1
# check new boundaries
if not $game_map.valid?(i,j) then next end
if $game_map.fow_grid[i,j,1] == FOW
others = true # can't flag as SKIP because there's nearby fog
if checked[i,j] == 0
checked[i,j] = 1
# only fill if not already revealed
if @fow_tilemap.map_data[i,j,2] != 0
adj = check_adjacent(i,j,1,$game_map.fow_grid,REVEALED)
if adj != nil
@fow_tilemap.map_data[i,j,2] =
eval '@fow_autotiles[adj.to_i]'
end
end
end
end
end
end
if not others
# no adjacent static fog found, so flag tile to avoid reprocessing
$game_map.fow_grid[x,y,1] |= SKIP
end
end
end # fow_static
end # for
end # for
if $game_map.fow_dynamic
if $game_map.fow_static
for x in dx-1 .. dx+21
for y in dy-1 .. dy+16
# erase dynamic fow if static fow is above it anyway
if @fow_tilemap.map_data[x,y,2] == 48
@fow_tilemap.map_data[x,y,1]=0 if @fow_tilemap.map_data[x,y,1]!=0
end
end
end
end
# calculate autotiles for dynamic fow (around player)
px = $game_player.x
py = $game_player.y
tiles = []
x = px - ($game_map.fow_range+1)
y_top = py
mod_top = -1
y_bot = py
mod_bot = 1
until x == px + ($game_map.fow_range+2)
tiles.push([x,y_top]) if $game_map.valid?(x,y_top)
tiles.push([x,y_bot]) if $game_map.valid?(x,y_bot)
if x == px
mod_top = 1
mod_bot = -1
x+=1
next
end
y_top+=1*mod_top
y_bot+=1*mod_bot
tiles.push([x,y_top]) if $game_map.valid?(x,y_top)
tiles.push([x,y_bot]) if $game_map.valid?(x,y_bot)
x+=1
end
tiles.uniq.each do |t|
adj = check_adjacent(t[0],t[1],0,$game_map.fow_grid,REVEALED)
if adj != nil
@fow_tilemap.map_data[t[0],t[1],1] =
(eval '@fow_autotiles[adj.to_i]') + 48
end
end
end
end
=begin
Update event transparency based on dynamic fog.
Note that if a specific character is passed as a parameter then only
its transparency is updated; otherwise, all events are processed.
=end
def update_event_transparency(pChar = nil)
return if not FOW_DYNAMIC_HIDES_EVENTS
if pChar == nil
# check them all
for i in $game_map.events.keys
event = $game_map.events[i]
if $game_map.fow_grid[event.x,event.y,0] == FOW
event.transparent = true
else
event.transparent = false
end
end
else
# just check the one
pChar.transparent=($game_map.fow_grid[pChar.x,pChar.y,0]==FOW) ?true:false
end
end
# create a list of tiles adjacent to a specific tile that don't match a flag
# (used for calculating tiles within an autotile)
def check_adjacent(i,j,k,grid,flag)
return if not $game_map.valid?(i,j) or grid == nil or flag == nil
adj = ''
if (i == 0)
adj << '147'
else
if (j == 0) then adj << '1'
else
if (grid[i-1,j-1,k] != flag) then adj << '1' end
end
if (grid[i-1,j,k] != flag) then adj << '4' end
if (j == $game_map.height-1) then adj << '7'
else
if (grid[i-1,j+1,k] != flag) then adj << '7' end
end
end
if (i == $game_map.width-1)
adj << '369'
else
if (j == 0) then adj << '3'
else
if (grid[i+1,j-1,k] != flag) then adj << '3' end
end
if (grid[i+1,j,k] != flag) then adj << '6' end
if (j == $game_map.height-1) then adj << '9'
else
if (grid[i+1,j+1,k] != flag) then adj << '9' end
end
end
if (j == 0)
adj << '2'
else
if (grid[i,j-1,k] != flag) then adj << '2' end
end
if (j == $game_map.height-1)
adj << '8'
else
if (grid[i,j+1,k] != flag) then adj << '8' end
end
# if no adjacent fog, set it as 0
if (adj == '') then adj = '0' end
# convert to an array, sort, and then back to a string
return adj.split(//).sort.join
end
alias wachunga_fow_ssm_dispose dispose
def dispose
@fow_tilemap.dispose if @fow_tilemap != nil
wachunga_fow_ssm_dispose
end
alias wachunga_fow_ssm_update update
def update
if $game_map.fow
@fow_tilemap.ox = $game_map.display_x / 4
@fow_tilemap.oy = $game_map.display_y / 4
end
wachunga_fow_ssm_update
end
end
#------------------------------------------------------------------------------
class Game_Character
alias wachunga_fow_gch_initialize initialize
def initialize
wachunga_fow_gch_initialize
@last_x = @x
@last_y = @y
end
alias wachunga_fow_gch_update_move update_move
def update_move
wachunga_fow_gch_update_move
if $game_map.fow
if $game_map.fow_dynamic and (@x != @last_x or @y != @last_y)\
and self != $game_player
# check if character entered/left player's visual range
$scene.spriteset.update_event_transparency(self)
end
end
@last_x = @x
@last_y = @y
end
end
#------------------------------------------------------------------------------
class Game_Player
def update_jump
super
# only update when about to land, not revealing anything jumped over
if $game_map.fow and @jump_count == 0
$game_map.update_fow_grid
$scene.spriteset.update_event_transparency if $game_map.fow_dynamic
$scene.spriteset.update_fow_tilemap
end
end
def update_move
if $game_map.fow and (@x != @last_x or @y != @last_y)
unless jumping?
$game_map.update_fow_grid
$scene.spriteset.update_event_transparency if $game_map.fow_dynamic
$scene.spriteset.update_fow_tilemap
end
end
super
end
end
#------------------------------------------------------------------------------
class Scene_Map
attr_reader :spriteset
end
=begin
Autotile in column 2:
row\col| 1 2 3 4 5 6 7 8
---------------------------
1 | 48 49 50 51 52 53 54 55
2 | 56 57 58 59 60 61 62 63
3 | 64 65 66 67 68 69 70 71
4 | 72 73 74 75 76 77 78 79
5 | 80 81 82 83 84 85 86 87
6 | 88 89 90 91 92 93 94 95
The function to return the index of a single tile within an autotile
(given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8
(where row, col, and at_index are again NOT zero-indexed)
=end
=begin
The following array lists systematic keys which are based on adjacent
walls (where 'W' is the wall itself):
1 2 3
4 W 6
7 8 9
e.g. 268 is the key that will be used to refer to the autotile
which has adjacent walls north, east, and south. For the Castle Prison
tileset (autotile #1), this is 67.
(It's a bit unwieldy, but it works.)
=end
Autotile_Keys = [
12346789,
2346789,
1246789,
246789,
1234678,
234678,
124678,
24678,
1234689,
234689,
124689,
24689,
123468,
23468,
12468,
2468,
23689,
2689,
2368,
268,
46789,
4678,
4689,
468,
12478,
1248,
2478,
248,
12346,
2346,
1246,
246,
28,
46,
689,
68,
478,
48,
124,
24,
236,
26,
8,
6,
2,
4,
0 ]
# many autotiles handle multiple situations
# this hash keeps track of which keys are identical
# to ones already defined above
Duplicate_Keys = {
123689 => 23689,
236789 => 23689,
1236789 => 23689,
34689 => 4689,
14689 => 4689,
134689 => 4689,
14678 => 4678,
34678 => 4678,
134678 => 4678,
146789 => 46789,
346789 => 46789,
1346789 => 46789,
23467 => 2346,
23469 => 2346,
234679 => 2346,
123467 => 12346,
123469 => 12346,
1234679 => 12346,
12467 => 1246,
12469 => 1246,
124679 => 1246,
124789 => 12478,
123478 => 12478,
1234789 => 12478,
146 => 46,
346 => 46,
467 => 46,
469 => 46,
1346 => 46,
1467 => 46,
1469 => 46,
3467 => 46,
3469 => 46,
4679 => 46,
13467 => 46,
13469 => 46,
14679 => 46,
34679 => 46,
134679 => 46,
128 => 28,
238 => 28,
278 => 28,
289 => 28,
1238 => 28,
1278 => 28,
1289 => 28,
2378 => 28,
2389 => 28,
2789 => 28,
12378 => 28,
12389 => 28,
12789 => 28,
23789 => 28,
123789 => 28,
1247 => 124,
2369 => 236,
147 => 4,
247 => 24,
14 => 4,
47 => 4,
1478 => 478,
3478 => 478,
4789 => 478,
134789 => 478,
14789 => 478,
13478 => 478,
34789 => 478,
1234 => 124,
1247 => 124,
1249 => 124,
12347 => 124,
12349 => 124,
12479 => 124,
123479 => 124,
1236 => 236,
2367 => 236,
2369 => 236,
12367 => 236,
12369 => 236,
23679 => 236,
123679 => 236,
12368 => 2368,
23678 => 2368,
123678 => 2368,
12348 => 1248,
12489 => 1248,
123489 => 1248,
1689 => 689,
3689 => 689,
6789 => 689,
13689 => 689,
16789 => 689,
36789 => 689,
136789 => 689,
12689 => 2689,
26789 => 2689,
126789 => 2689,
23478 => 2478,
24789 => 2478,
234789 => 2478,
12 => 2,
23 => 2,
27 => 2,
29 => 2,
123 => 2,
127 => 2,
129 => 2,
237 => 2,
239 => 2,
279 => 2,
1237 => 2,
1239 => 2,
1279 => 2,
2379 => 2,
12379 => 2,
14 => 4,
47 => 4,
34 => 4,
49 => 4,
147 => 4,
134 => 4,
347 => 4,
349 => 4,
149 => 4,
479 => 4,
1347 => 4,
1479 => 4,
1349 => 4,
3479 => 4,
13479 => 4,
16 => 6,
36 => 6,
67 => 6,
69 => 6,
136 => 6,
167 => 6,
169 => 6,
367 => 6,
369 => 6,
679 => 6,
1369 => 6,
3679 => 6,
1367 => 6,
1679 => 6,
13679 => 6,
78 => 8,
89 => 8,
18 => 8,
38 => 8,
138 => 8,
789 => 8,
178 => 8,
189 => 8,
378 => 8,
389 => 8,
1789 => 8,
3789 => 8,
1378 => 8,
1389 => 8,
13789 => 8,
1468 => 468,
3468 => 468,
13468 => 468,
2467 => 246,
2469 => 246,
24679 => 246,
2348 => 248,
2489 => 248,
23489 => 248,
1268 => 268,
2678 => 268,
12678 => 268,
148 => 48,
348 => 48,
489 => 48,
1348 => 48,
1489 => 48,
3489 => 48,
13489 => 48,
168 => 68,
368 => 68,
678 => 68,
1368 => 68,
1678 => 68,
3678 => 68,
13678 => 68,
234 => 24,
247 => 24,
249 => 24,
2347 => 24,
2349 => 24,
2479 => 24,
23479 => 24,
126 => 26,
267 => 26,
269 => 26,
1267 => 26,
1269 => 26,
2679 => 26,
12679 => 26,
} |
zum Lesen den Text mit der Maus markieren
|
|
Dynamic Maps Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#================================
# ■ Dynamic Maps
#================================
# By: Near Fantastica
# Date: 05.09.05
# Version: 1
#================================
# updated 2005-11-07 by Wachunga
# generalized to work for modified versions of Game_Map,
# e.g. even if more instance variables are added
module Map
#--------------------------------------------------------------
@map_data = {}
#--------------------------------------------------------------------------
def Map.set_map(map, map_id)
@map_data[map_id] = map
end
#--------------------------------------------------------------------------
def Map.data(map_id)
return @map_data[map_id]
end
end
class Game_Map
#--------------------------------------------------------------
alias dm_orig_setup setup
def setup(map_id)
save_map(@map_id)
if Map.data(map_id) == nil
dm_orig_setup(map_id)
else
load_map(map_id)
end
end
#-----------------------------------------------------------
def load_map(map_id)
$game_map = Map.data(map_id)
end
#--------------------------------------------------------------
def save_map(map_id)
return if map_id == 0
Map.set_map(self.dup, map_id)
end
end |
zum Lesen den Text mit der Maus markieren
Pixelmovement:
|
|
Pixelmovement Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
#==================================================================
# GMUS Guedez Mouse Use System
# Version: 1.0
# Released: 26/5/2006 Last Update: 1/6/2006
# Thx to: Cadafalso, Near Fantastica, and some guys from asylum!
#==================================================================
class Mouse_PositionCheck
def initialize
end
def main
get_pos
end
def get_window_index(window)
window.get_rect_positions
return -1 if window.index == -1
return -2 if window.index == -2
for i in 0...window.get_rect.size
if window.get_rect[i][0] < $bg.x and
window.get_rect[i][1] < $bg.y and
window.get_rect[i][2] > $bg.x and
window.get_rect[i][3] > $bg.y
return i
end
end
return -999999
end
def set_pos(x,y)
$setCursorPos.Call(x,y)
end
#==============================Thx to: Cadafalso===================
def get_pos
lpPoint = " " * 8 # store two LONGs
$getCursorPos.Call(lpPoint)
$bg.x, $bg.y = lpPoint.unpack("LL") # get the actual values
end
#==================================================================
end
class Window_Selectable < Window_Base
def get_rect_positions
index = self.index
@rect_position = [] if @rect_position == nil
if @rect_position == []
for i in 0...(self.row_max * @column_max)
self.index = i
update_cursor_rect
p = self.cursor_rect.to_s
p.gsub!("($1,$2,$3,$4):rect","");p.gsub!("(", ""); p.gsub!(")", "")
p = p.split(/,\s*/)
@rect_position[i] = [p[0].to_i + self.x + 16,
p[1].to_i - self.oy + self.y + 16,
p[0].to_i + p[2].to_i + self.x + 16,
p[1].to_i + p[3].to_i - self.oy + self.y + 16]
end
self.index = index
end
end
def refresh_rect_positions
@rect_position = []
get_rect_positions
end
def get_rect
return @rect_position
end
alias guedez_update update
def update
get_rect_positions
if self.active == true
old_index = self.index
new_index = $mouse.get_window_index(self)
$game_system.se_play($data_system.cursor_se) if
old_index != new_index and not new_index == -999999
@index = new_index if old_index != -1
self.cursor_rect.empty if new_index == -999999
self.index = new_index
end
guedez_update
end
end
# Actualy my script only need the mouse stuff, but i dont think
# the rest will bring any trouble :D, so i let the full script
#==============================================================================
# ** Keyboard Input Module
#==============================================================================
# Near Fantastica
# Version 5
# 29.11.05
#==============================================================================
# The Keyboard Input Module is designed to function as the default Input module
# dose. It is better then other methods keyboard input because as a key is
# tested it is not removed form the list. so you can test the same key multiple
# times the same loop.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
#SDK.log("Keyboard Input", "Near Fantastica", 5, "29.11.05")
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
#if SDK.state("Keyboard Input") == true
module Keyboard
#--------------------------------------------------------------------------
@keys = []
@pressed = []
Mouse_Left = 1
Mouse_Right = 2
Back= 8
Tab = 9
Enter = 13
Shift = 16
Ctrl = 17
Alt = 18
Esc = 27
Space = 32
Numberkeys = {}
Numberkeys[0] = 48
Numberkeys[1] = 49
Numberkeys[2] = 50
Numberkeys[3] = 51
Numberkeys[4] = 52
Numberkeys[5] = 53
Numberkeys[6] = 54
Numberkeys[7] = 55
Numberkeys[8] = 56
Numberkeys[9] = 57
Numberpad = {}
Numberpad[0] = 45
Numberpad[1] = 35
Numberpad[2] = 40
Numberpad[3] = 34
Numberpad[4] = 37
Numberpad[5] = 12
Numberpad[6] = 39
Numberpad[7] = 36
Numberpad[8] = 38
Numberpad[9] = 33
Letters = {}
Letters["A"] = 65
Letters["B"] = 66
Letters["C"] = 67
Letters["D"] = 68
Letters["E"] = 69
Letters["F"] = 70
Letters["G"] = 71
Letters["H"] = 72
Letters["I"] = 73
Letters["J"] = 74
Letters["K"] = 75
Letters["L"] = 76
Letters["M"] = 77
Letters["N"] = 78
Letters["O"] = 79
Letters["P"] = 80
Letters["Q"] = 81
Letters["R"] = 82
Letters["S"] = 83
Letters["T"] = 84
Letters["U"] = 85
Letters["V"] = 86
Letters["W"] = 87
Letters["X"] = 88
Letters["Y"] = 89
Letters["Z"] = 90
Fkeys = {}
Fkeys[1] = 112
Fkeys[2] = 113
Fkeys[3] = 114
Fkeys[4] = 115
Fkeys[5] = 116
Fkeys[6] = 117
Fkeys[7] = 118
Fkeys[8] = 119
Fkeys[9] = 120
Fkeys[10] = 121
Fkeys[11] = 122
Fkeys[12] = 123
Collon = 186
Equal = 187
Comma = 188
Underscore = 189
Dot = 190
Backslash = 191
Lb = 219
Rb = 221
Quote = 222
State = Win32API.new("user32","GetKeyState",['i'],'i')
Key = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
#--------------------------------------------------------------------------
def Keyboard.getstate(key)
return true unless State.call(key).between?(0, 1)
return false
end
#--------------------------------------------------------------------------
def Keyboard.testkey(key)
Key.call(key) & 0x01 == 1
end
#--------------------------------------------------------------------------
def Keyboard.update
@keys = []
@keys.push(Keyboard::Mouse_Left) if Keyboard.testkey(Keyboard::Mouse_Left)
@keys.push(Keyboard::Mouse_Right) if Keyboard.testkey(Keyboard::Mouse_Right)
@keys.push(Keyboard::Back) if Keyboard.testkey(Keyboard::Back)
@keys.push(Keyboard::Tab) if Keyboard.testkey(Keyboard::Tab)
@keys.push(Keyboard::Enter) if Keyboard.testkey(Keyboard::Enter)
@keys.push(Keyboard::Shift) if Keyboard.testkey(Keyboard::Shift)
@keys.push(Keyboard::Ctrl) if Keyboard.testkey(Keyboard::Ctrl)
@keys.push(Keyboard::Alt) if Keyboard.testkey(Keyboard::Alt)
@keys.push(Keyboard::Esc) if Keyboard.testkey(Keyboard::Esc)
@keys.push(Keyboard::Space) if Keyboard.testkey(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Numberpad.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Letters.values
@keys.push(key) if Keyboard.testkey(key)
end
for key in Keyboard::Fkeys.values
@keys.push(key) if Keyboard.testkey(key)
end
@keys.push(Keyboard::Collon) if Keyboard.testkey(Keyboard::Collon)
@keys.push(Keyboard::Equal) if Keyboard.testkey(Keyboard::Equal)
@keys.push(Keyboard::Comma) if Keyboard.testkey(Keyboard::Comma)
@keys.push(Keyboard::Underscore) if Keyboard.testkey(Keyboard::Underscore)
@keys.push(Keyboard::Dot) if Keyboard.testkey(Keyboard::Dot)
@keys.push(Keyboard::Backslash) if Keyboard.testkey(Keyboard::Backslash)
@keys.push(Keyboard::Lb) if Keyboard.testkey(Keyboard::Lb)
@keys.push(Keyboard::Rb) if Keyboard.testkey(Keyboard::Rb)
@keys.push(Keyboard::Quote) if Keyboard.testkey(Keyboard::Quote)
@pressed = []
@pressed.push(Keyboard::Mouse_Left) if Keyboard.getstate(Keyboard::Mouse_Left)
@pressed.push(Keyboard::Mouse_Right) if Keyboard.getstate(Keyboard::Mouse_Right)
@pressed.push(Keyboard::Back) if Keyboard.getstate(Keyboard::Back)
@pressed.push(Keyboard::Tab) if Keyboard.getstate(Keyboard::Tab)
@pressed.push(Keyboard::Enter) if Keyboard.getstate(Keyboard::Enter)
@pressed.push(Keyboard::Shift) if Keyboard.getstate(Keyboard::Shift)
@pressed.push(Keyboard::Ctrl) if Keyboard.getstate(Keyboard::Ctrl)
@pressed.push(Keyboard::Alt) if Keyboard.getstate(Keyboard::Alt)
@pressed.push(Keyboard::Esc) if Keyboard.getstate(Keyboard::Esc)
@pressed.push(Keyboard::Space) if Keyboard.getstate(Keyboard::Space)
for key in Keyboard::Numberkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Numberpad.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Letters.values
@pressed.push(key) if Keyboard.getstate(key)
end
for key in Keyboard::Fkeys.values
@pressed.push(key) if Keyboard.getstate(key)
end
@pressed.push(Keyboard::Collon) if Keyboard.getstate(Keyboard::Collon)
@pressed.push(Keyboard::Equal) if Keyboard.getstate(Keyboard::Equal)
@pressed.push(Keyboard::Comma) if Keyboard.getstate(Keyboard::Comma)
@pressed.push(Keyboard::Underscore) if Keyboard.getstate(Keyboard::Underscore)
@pressed.push(Keyboard::Dot) if Keyboard.getstate(Keyboard::Dot)
@pressed.push(Keyboard::Backslash) if Keyboard.getstate(Keyboard::Backslash)
@pressed.push(Keyboard::Lb) if Keyboard.getstate(Keyboard::Lb)
@pressed.push(Keyboard::Rb) if Keyboard.getstate(Keyboard::Rb)
@pressed.push(Keyboard::Quote) if Keyboard.getstate(Keyboard::Quote)
end
#--------------------------------------------------------------------------
def Keyboard.trigger?(key)
return true if @keys.include?(key)
return false
end
#--------------------------------------------------------------------------
def Keyboard.pressed?(key)
return true if @pressed.include?(key)
return false
end
#end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
#=========================Game_Fixes=============================
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
$mouse = Mouse_PositionCheck.new
$getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')
$setCursorPos = Win32API.new("user32", "SetCursorPos", ['I','I'], 'V')
$bg = Sprite.new
$bg.bitmap = RPG::Cache.icon('001-Weapon01')
$bg.z = 999999
$bg.y = 0
$bg.x = 0
module Input
if @self_update == nil
@self_update = method('update')
@self_press = method('press?')
@self_rep = method('repeat?')
end
def self.update
@self_update.call
$mouse.main
Keyboard.update
end
def self.trigger?(key_code)
if @self_press.call(key_code)
return true
end
if key_code == C
return Keyboard.trigger?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.trigger?(Keyboard::Mouse_Right)
else
return @self_press.call(key_code)
end
end
def self.repeat?(key_code)
if @self_rep.call(key_code)
return true
end
if key_code == C
return Keyboard.pressed?(Keyboard::Mouse_Left)
elsif key_code == B
return Keyboard.pressed?(Keyboard::Mouse_Right)
else
return @self_rep.call(key_code)
end
end
end
class Arrow_Enemy < Arrow_Base
def update
super
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
#size = 0
#for i in 0...$game_troop.enemies.size
# size += 1 if $game_troop.enemies[i].hp > 0
#end
size = $game_troop.enemies.size if size == nil
@index = ((size / 640.0) * $bg.x.to_f).to_i
if self.enemy != nil
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
@index = 0 if $bg.x > 0 and $bg.x <= 160 and 0 <= ($game_party.actors.size - 1)
@index = 1 if $bg.x > 160 and $bg.x <= 320 and 1 <= ($game_party.actors.size - 1)
@index = 2 if $bg.x > 320 and $bg.x <= 480 and 2 <= ($game_party.actors.size - 1)
@index = 3 if $bg.x > 480 and $bg.x <= 640 and 3 <= ($game_party.actors.size - 1)
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
class Window_Target < Window_Selectable
alias gupdate update
def update
@defaultx = 0 if @defaultx == nil
if @defaultx != self.x
@defaultx = self.x
self.refresh_rect_positions
return
else
gupdate
end
end
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
class Scene_Battle
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x = @actor_index * 160
@actor_command_window.refresh_rect_positions
@actor_command_window.index = 0
end
end
class Scene_Equip
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
@actor = $game_party.actors[@actor_index]
end
alias gmain main
def main
@dummy = Window_EquipItem.new(@actor, 99)
gmain
@dummy.dispose
end
alias gupdate_right update_right
def update_right
if @right_window.index == -999999
if Input.trigger?(Input::C)
$game_system.se_play($data_system.buzzer_se)
end
else
gupdate_right
end
end
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
@dummy.visible = (@right_window.index == -999999)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
when -999999
return
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
end
class Scene_Skill
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index == -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index <= -3
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Scene_File
def update
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::C)
if @file_index == -1
$game_system.se_play($data_system.buzzer_se)
else
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
end
if Input.trigger?(Input::B)
on_cancel
return
end
if $bg.y > 64 and $bg.y < 168
if @savefile_windows[0].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = true
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 0
elsif $bg.y > 168 and $bg.y < 272
if @savefile_windows[1].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = true
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
@file_index = 1
elsif $bg.y > 272 and $bg.y < 376
if @savefile_windows[2].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = true
@savefile_windows[3].selected = false
@file_index = 2
elsif $bg.y > 376 and $bg.y < 480
if @savefile_windows[3].selected == false
$game_system.se_play($data_system.cursor_se)
end
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = true
@file_index = 3
else
@file_index = -1
@savefile_windows[0].selected = false
@savefile_windows[1].selected = false
@savefile_windows[2].selected = false
@savefile_windows[3].selected = false
end
end
end
class Scene_Menu
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
unless @status_window.index < 0
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
class Game_Player
def update
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_curor_field
if (@field_x == self.x + 1 and @field_y == self.y and
self.direction == 6) or (@field_x == self.x - 1 and
@field_y == self.y and self.direction == 4) or
(@field_x == self.x and @field_y == self.y + 1 and
self.direction == 2) or (@field_x == self.x and
@field_y == self.y - 1 and self.direction == 8)
check_event_trigger_there([0,1,2])
end
end
if Input.repeat?(Input::C)
check_curor_field
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or
@cant_move and not (@field_x == self.x and @field_y == self.y)
move_by_mouse
end
check_event_trigger_here([0])
end
end
end
def check_curor_field
dummyx = $game_map.display_x > 0 ? $bg.x + 16 : $bg.x
@field_x = dummyx / 32 + $game_map.display_x / 128
@field_y = $bg.y / 32 + $game_map.display_y / 128
end
def move_by_mouse
dy = @field_x - self.x
dx = self.y - @field_y
if dx > 0 and dy > 0 #quarter 1
if dx > dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
elsif dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_up
end
return
elsif dx == dy
if passable?(self.x, self.y, 8)
move_up
else
move_right
end
return
end
elsif dx > 0 and dy < 0 #quarter 2
if dx > -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
elsif dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_up
end
return
elsif dx == -dy
if passable?(self.x, self.y, 8)
move_up
else
move_left
end
return
end
elsif dx < 0 and dy < 0 #quarter 2
if -dx > -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
elsif -dx < -dy
if passable?(self.x, self.y, 4)
move_left
else
move_down
end
return
elsif -dx == -dy
if passable?(self.x, self.y, 2)
move_down
else
move_left
end
return
end
elsif dx < 0 and dy > 0 #quarter 4
if -dx > dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
elsif -dx < dy
if passable?(self.x, self.y, 6)
move_right
else
move_down
end
return
elsif -dx == dy
if passable?(self.x, self.y, 2)
move_down
else
move_right
end
return
end
elsif dx == 0 and dy < 0
move_left
elsif dx == 0 and dy > 0
move_right
elsif dx < 0 and dy == 0
move_down
elsif dx > 0 and dy == 0
move_up
end
end
end |
zum Lesen den Text mit der Maus markieren
-
Mein Zeugs -
euer Google wenns um den Maker geht^^
Dieser Beitrag wurde bereits so oft editiert, dass der Zähler sich in die Luft gesprengt hat.

