Tetris script wirft mir syntax errors O.o
...noch ein problem: beim tetris script aus dem itzamna, erscheint ein syntax error (siehe anhang), als ich diessn versucht hab auszubessern hat das script wieder an einer anderen stelle einen syntax error.
danke im voraus
MfG ~kirin~
danke im voraus
MfG ~kirin~
Am Grund der Seele, in meinen Träumen
Ist Schönheit Stille, nichts als Wind in alten Bäumen.
Über den Lärm der Städte, das weite Land
Gewinnt das Lied der Blätter die Oberhand.
Ist Schönheit Stille, nichts als Wind in alten Bäumen.
Über den Lärm der Städte, das weite Land
Gewinnt das Lied der Blätter die Oberhand.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Yukinayami« (28. Juni 2010, 14:45) aus folgendem Grund: anhang vergessen^^
hört sich nach falsch gesetzten bzw fehlenden end zeilen an.
Anhang?
Anhang?

My Deviantart : )
StepSound Script:
|
|
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 |
#==================================
# Step Sound Script
#---------------------------------------------------
# @Autor Bananni
# @Date 07/08/2010
#==================================
class Game_Player
# CONFIGS
STEP_SOUND_VOLUME = 100
STEP_SOUND_PITCH = 100
STEP_SOUND_ARRAY=[
["",0], # TERRAIN ID = 0
["test.wav",10], # TERRAIN ID = 1
["",0], # TERRAIN ID = 2
["",0], # TERRAIN ID = 3
["",0], # TERRAIN ID = 4
["",0], # TERRAIN ID = 5
["",0], # TERRAIN ID = 6
["",0], # TERRAIN ID = 7
["",0], # TERRAIN ID = 8
["",0] # TERRAIN ID = 9
]
# ENDE CONFIGS
alias :increase_steps_banannis_shit :increase_steps
alias :update_banannis_shit :update
def increase_steps
increase_steps_banannis_shit
if @step_countdown == 0
id = $game_map.terrain_tag(x, y)
if STEP_SOUND_ARRAY[id][0] != ""
Audio.se_play("Audio/SE/" + STEP_SOUND_ARRAY[id][0], STEP_SOUND_VOLUME, STEP_SOUND_PITCH)
@step_countdown=STEP_SOUND_ARRAY[id][1]
end
end
end
def update
update_banannis_shit
if @step_countdown == nil
@step_countdown=0
end
if @step_countdown != 0
@step_countdown-=1
end
end
end |
Map Roots
|
|
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 |
#==================================
# Map Names & Map Root
#---------------------------------------------------
# @Autor Bananni
# @Date 07/08/2010
#---------------------------------------------------
# Get Map Name:
# $game_system.map_names[any_map_id]
# Get Map Root ID:
# $game_system.parent_map(any_map_id)
#==================================
class Game_System
attr_reader :map_names
alias :wtf_bananni_alias_this_game_system_init :initialize
def initialize
wtf_bananni_alias_this_game_system_init
read_map_names
end
def parent_map id=$game_map.map_id
while true
par=@map_parent[id]
break if par == 0
id=par
end
return @map_names[id]
end
def read_map_names
map_infos = load_data("Data/MapInfos.rxdata")
@map_names = Array.new
@map_parent = Array.new
for key in map_infos.keys
@map_names[key] = map_infos[key].name
@map_parent[key] = map_infos[key].parent_id
end
end
end |
zum Lesen den Text mit der Maus markieren
Bei mir läufts einwand frei.
Über Main eifügen, aufrufen über:
Schwirigkeitsgrad 1:
Tetris.start 1
Schwirigkeitsgrad 2:
Tetris.start 2
Schwirigkeitsgrad 3:
Tetris.start 3
Schwirigkeitsgrad n:
Tetris.start n
Über Main eifügen, aufrufen über:
Schwirigkeitsgrad 1:
Tetris.start 1
Schwirigkeitsgrad 2:
Tetris.start 2
Schwirigkeitsgrad 3:
Tetris.start 3
Schwirigkeitsgrad n:
Tetris.start n
|
|
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 |
#==============================================================================
# ** Tetris V1
# Tetris.rb by Multitoeat, ??? (10.09.2009)
#------------------------------------------------------------------------------
# http://www.rpg-studio.de/scriptdb/node/417
# http://www.rpg-studio.de/forum/index.php?page=Thread&threadID=29252
#==============================================================================
module Tetris
FOND_ECRAN = nil
ECRAN_JEU = Viewport.new(52, 0, 240, 535)
ECRAN_PIECE = Rect.new(400, 80, 116,116)
ECRAN_SCORE = Rect.new(360, 220, 170, 150)
PIECES = [[[[false, false, false, false],
[false, true, true, false],
[false, true, true, false],
[false, false, false, false]],
Color.new(0, 0, 255)],
[[[false, true, false, false],
[false, true,false, false],
[false, true, false, false],
[false, true, false, false]],
Color.new(255, 0, 0)],
[[[false, false, false, false],
[false, true, false, false],
[true, true, true, false],
[false, false, false, false]],
Color.new(255, 85, 0)],
[[[false, false, false, false],
[false, true,true, false],
[true, true, false, false],
[false, false, false, false]],
Color.new(0, 255, 0)],
[[[false, false, false, false],
[false, true,true, false],
[false, false, true, true],
[false, false, false, false]],
Color.new(255, 0, 255)],
[[[false, false, false, false],
[false, false,true, false],
[true, true, true, false],
[false, false, false, false]],
Color.new(255, 255, 0)],
[[[false, false, false, false],
[true, false,false, false],
[true, true, true, false],
[false, false, false, false]],
Color.new(119, 85, 136)]]
#=======================================================================
#
#=======================================================================
def Tetris.start(n = 1)
@score = 0
@ligne = 0
@niveau = 0
$scene = Scene_Jeu.new(n)
end
#=======================================================================
#Score nombre de lineas
#=======================================================================
def Tetris.score(n = 1)
@score += n
return @score
end
def Tetris.score_to_var(n)
$game_variables[n] = @score
end
def Tetris.ligne(l = 0)
@ligne += l
return @ligne
end
def Tetris.ligne_to_var(n)
$game_variables[n] = @ligne
end
def Tetris.niveau(n = 0)
@niveau += n
return @niveau
def Tetris.niveau_to_var(n)
$game_variables[n] = @niveau
end
end
#=======================================================================
#PIECE
#=======================================================================
class Piece < Sprite
attr_reader :matrice
def initialize
super(ECRAN_JEU)
@piece = PIECES[rand(7)]
@matrice = @piece[0]
self.bitmap = Bitmap.new(84, 84)
@couleur = @piece[1]
self.y = 0
self.x = 42
@undo = proc {self.visible = true}
refresh
end
def refresh
self.bitmap.clear
4.times do |i|
4.times do |j|
if @matrice[j][i]
rect1 = Rect.new(21 * i, 21 * j, 21, 21)
rect2 = Rect.new(21 * i + 1, 21 * j + 1, 19, 19)
self.bitmap.fill_rect(rect1, Color.new(0, 255, 255))
self.bitmap.fill_rect(rect2, @couleur)
end
end
end
end
def move_left
@undo = proc {move_right}
self.x -= 21
end
def move_right
@undo = proc {move_left}
self.x += 21
end
def rotate_right
@undo = proc {rotate_left}
piece = [[],[],[],[]]
4.times do |i|
4.times do |j|
piece[i][j] = @matrice[3 - j][i]
end
end
@matrice = piece
refresh
end
def rotate_left
@undo = proc {rotate_right}
piece = [[],[],[],[]]
4.times do |i|
4.times do |j|
piece[i][j] = @matrice[j][3 - i]
end
end
@matrice = piece
refresh
end
def move
@undo = proc {self.y -= 21}
self.y += 21
end
def undo
@undo.call
end
end
#=======================================================================
#define score
#=======================================================================
class Score < Window_Base
def initialize
super( 330,200,200,200)
self.contents = Bitmap.new(self.width - 32, self.height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 200, 30, "Level : #{Tetris.niveau}")
self.contents.draw_text(0, 30, 200, 30, "Reihe : #{Tetris.ligne}")
self.contents.draw_text(0, 60, 200, 30, "Punkte : #{Tetris.score}")
end
def niveau(l)
Tetris.niveau(1) if Tetris.ligne / 10 != Tetris.ligne(l) / 10
Tetris.score(10 * l * (l + 1) / 2)
refresh
end
end
#======================================================================
#
#======================================================================
class Window_Piece < Window_Base
def initialize
super(ECRAN_PIECE.x, ECRAN_PIECE.y, ECRAN_PIECE.width, ECRAN_PIECE.height)
self.opacity = 180
self.z = 2
end
end
#=======================================================================
#define el puntaje
#=======================================================================
class Window_Fin < Window_Base
def initialize
super(150, 100, 300, 100)
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.font.color = Color.new(255, 255, 0)
self.z = 10
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 14, self.width - 32, 40, "Punkte : #{Tetris.score}", 1)
end
end
#=======================================================================
#Scene
#=======================================================================
class Scene_Jeu
def initialize(niveau = 1)
@ecran_jeu = Sprite.new(ECRAN_JEU)
@ecran_jeu.bitmap = Bitmap.new(200, 430)
@window_piece = Window_Piece.new
bgm_play = "mario"
unless FOND_ECRAN == nil
@fond = Plane.new
@fond.bitmap = Bitmap.new("Graphics/Pictures/amigo")
@fond.z = - 1
end
@piece = Piece.new
@suivante = Piece.new
@suivante.visible = false
@window_piece.contents = @suivante.bitmap
@puit = Array.new(24)
24.times do |y|
@puit[y] = Array.new(12, false)
@puit[y][0] = @puit [y][11] = true
end
12.times do |x|
@puit[22][x] = @puit[21][x] = true
end
afficher_puit
@vitesse = 0.75**niveau
@temps = Time.new
Tetris.niveau(niveau)
@ligne = 0
@score = Score.new
end
def main
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
@piece.dispose
@score.dispose
@fond.dispose unless FOND_ECRAN == nil
@suivante.dispose
@ecran_jeu.dispose
@murs.dispose
@window_piece.dispose
end
def update
@piece.move_left if Input.repeat?(Input::LEFT)
@piece.move_right if Input.repeat?(Input::RIGHT)
@piece.rotate_left if Input.trigger?(Input::C)
@piece.undo if test_piece
game_over if Input.trigger?(Input::B)
if Input.press?(Input::DOWN)
Graphics.update
Graphics.update
@temps = Time.new
@piece.move
pose_piece if test_piece
elsif (Time.new - @temps) > @vitesse
@temps = Time.new
@piece.move
pose_piece if test_piece
end
end
#=======================================================================
#
#=======================================================================
def afficher_puit
@murs = Sprite.new
@murs.bitmap = Bitmap.new(252,420)
@murs.x = ECRAN_JEU.rect.x - 21
@murs.y = ECRAN_JEU.rect.y
@murs.z = 1
23.times do |y|
@murs.bitmap.fill_rect(0, 21 * y, 21, 21, Color.new(136, 92, 189))
@murs.bitmap.fill_rect(1, 21 * y + 1, 19, 19, Color.new(67, 210, 154))
@murs.bitmap.fill_rect(231, 21 * y, 21, 21, Color.new(136, 92, 189))
@murs.bitmap.fill_rect(232, 21 * y + 1, 19, 19, Color.new(67, 210, 154))
end
for x in 1..10
@murs.bitmap.fill_rect(21 * x, 462, 21, 21, Color.new(136, 92, 189))
@murs.bitmap.fill_rect(21 * x + 1, 463, 19, 19, Color.new(67, 210, 154))
end
end
#=======================================================================
#
#=======================================================================
def test_piece
x = @piece. x / 21 + 1
y = @piece.y / 21
4.times do |j|
4.times do |i|
return true if @piece.matrice[ j][i] and @puit[y + j][x + i]
end
end
return false
end
#=======================================================================
#Pose la piece
#=======================================================================
def pose_piece
@piece.undo
@ecran_jeu.bitmap.blt(@piece.x, @piece.y, @piece.bitmap, Rect.new(0, 0, 84, 84))
x = @piece. x / 21 + 1
y = @piece.y / 21
4.times do |j|
4.times do |i|
@puit[y + j][x + i] = true if @piece.matrice[j][i]
end
end
count = 0
for i in y..[y + 4, 21].min do
if test_ligne(i)
supprime_ligne(i)
count += 1
end
end
@score.niveau(count)
@vitesse = 0.75**Tetris.niveau
@piece.dispose
@piece = @suivante
@piece.visible = true
if test_piece
@piece.undo
game_over
end
@suivante = Piece.new
@suivante.visible = false
@window_piece.contents = @suivante.bitmap
end
#=======================================================================
#
#=======================================================================
def test_ligne(y)
r = true
for x in 1..10 do
unless @puit[y][x]
r = false
break
end
end
return r
end
#=======================================================================
#Supprime une ligne
#========================================================================
def supprime_ligne(ligne)
y = ligne * 21
image = Bitmap.new(210, 462)
image.blt(0, 21, @ecran_jeu.bitmap, Rect.new(0, 0, 210, y))
image.blt(0, y + 21, @ecran_jeu.bitmap, Rect.new(0, y + 21, 210, 451 - y))
@ecran_jeu.bitmap.clear
@ecran_jeu.bitmap.blt(0, 0, image, Rect.new(0, 0, 210, 462))
tableau = Array.new(24)
24.times {|l| tableau[l] = Array.new(12, false)}
24.times do |j|
12.times do |i|
if j < ligne
tableau[j + 1][i] = @puit[j][i]
elsif j > ligne
tableau[j][i] = @puit[j][i]
end
end
end
tableau[0][0] = tableau [0][11] = true
@puit = tableau
end
def game_over
@window = Window_Fin.new
loop do
Graphics.update
Input.update
break if Input.trigger?(Input::C)
end
$scene = Scene_Map.new
@window.dispose
end
end
end |
zum Lesen den Text mit der Maus markieren

My Deviantart : )
StepSound Script:
|
|
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 |
#==================================
# Step Sound Script
#---------------------------------------------------
# @Autor Bananni
# @Date 07/08/2010
#==================================
class Game_Player
# CONFIGS
STEP_SOUND_VOLUME = 100
STEP_SOUND_PITCH = 100
STEP_SOUND_ARRAY=[
["",0], # TERRAIN ID = 0
["test.wav",10], # TERRAIN ID = 1
["",0], # TERRAIN ID = 2
["",0], # TERRAIN ID = 3
["",0], # TERRAIN ID = 4
["",0], # TERRAIN ID = 5
["",0], # TERRAIN ID = 6
["",0], # TERRAIN ID = 7
["",0], # TERRAIN ID = 8
["",0] # TERRAIN ID = 9
]
# ENDE CONFIGS
alias :increase_steps_banannis_shit :increase_steps
alias :update_banannis_shit :update
def increase_steps
increase_steps_banannis_shit
if @step_countdown == 0
id = $game_map.terrain_tag(x, y)
if STEP_SOUND_ARRAY[id][0] != ""
Audio.se_play("Audio/SE/" + STEP_SOUND_ARRAY[id][0], STEP_SOUND_VOLUME, STEP_SOUND_PITCH)
@step_countdown=STEP_SOUND_ARRAY[id][1]
end
end
end
def update
update_banannis_shit
if @step_countdown == nil
@step_countdown=0
end
if @step_countdown != 0
@step_countdown-=1
end
end
end |
Map Roots
|
|
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 |
#==================================
# Map Names & Map Root
#---------------------------------------------------
# @Autor Bananni
# @Date 07/08/2010
#---------------------------------------------------
# Get Map Name:
# $game_system.map_names[any_map_id]
# Get Map Root ID:
# $game_system.parent_map(any_map_id)
#==================================
class Game_System
attr_reader :map_names
alias :wtf_bananni_alias_this_game_system_init :initialize
def initialize
wtf_bananni_alias_this_game_system_init
read_map_names
end
def parent_map id=$game_map.map_id
while true
par=@map_parent[id]
break if par == 0
id=par
end
return @map_names[id]
end
def read_map_names
map_infos = load_data("Data/MapInfos.rxdata")
@map_names = Array.new
@map_parent = Array.new
for key in map_infos.keys
@map_names[key] = map_infos[key].name
@map_parent[key] = map_infos[key].parent_id
end
end
end |
zum Lesen den Text mit der Maus markieren
Ähnliche Themen
-
Einsteigerhilfe »-
Cheats Input Script V2.0 aufrufproblem
(23. Juni 2010, 17:35)
-
RGSS 1 Probleme & Talk »-
Probleme mit Script
(19. Juni 2010, 12:08)
-
Taverne zum philosophischen Phönix »-
Euer erstes Spiel
(1. Januar 2009, 20:37)
-
Programmierhilfen »-
unsort-Methode V1
(16. Juni 2007, 13:11)
