IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Programmation multimédia/Jeux Python Discussion :

equivalence en python ?


Sujet :

Programmation multimédia/Jeux Python

  1. #1
    Membre habitué
    Homme Profil pro
    Lycéen
    Inscrit en
    Mars 2016
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Lycéen

    Informations forums :
    Inscription : Mars 2016
    Messages : 10
    Par défaut equivalence en python ?
    bonjour

    quel est l’équivalence en python de ce script ? merci

    Code VB : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    ' *********************************************************************
    ' **                                                                 **
    ' **                        FUTURE PINBALL                           **
    ' **                                                                 **
    ' **                   Generic Table Script v1.0                     **
    ' **                                                                 **
    ' **     (C) 2007 Chris Leathley - BSP Software Design Solutions     **
    ' **                                                                 **
    ' ** This script should provide a simple frame work you can use in   **
    ' ** your own tables as a starting point.                            **
    ' **                                                                 **
    ' *********************************************************************
     
    Option Explicit				' Force explicit variable declaration
     
     
    ' Define any Constants 
    Const constMaxPlayers 		= 4 		' Maximum number of players per game (between 1 and 4)
    Const constBallSaverTime	= 5000	' Time in which a free ball is given if it lost very quickly
    												' Set this to 0 if you don't want this feature
    Const constMaxMultiplier	= 6		' Defines the maximum bonus multiplier level
     
    ' Define Global Variables
    '
    Dim PlayersPlayingGame		' number of players playing the current game
    Dim CurrentPlayer				' current player (1-4) playing the game
    Dim BonusPoints(4)			' Bonus Points for the current player
    Dim BonusMultiplier(4)		' Bonus Multiplier for the current player
    Dim BallsRemaining(4)		' Balls remaining to play (inclusive) for each player
    Dim ExtraBallsAwards(4)		' number of EB's out-standing (for each player)
     
    ' Define Game Control Variables
    Dim LastSwitchHit				' Id of last switch hit
    Dim BallsOnPlayfield			' number of balls on playfield (multiball exclusive)
    Dim BallsInLock				' number of balls in multi-ball lock
     
    ' Define Game Flags
    Dim bFreePlay					' Either in Free Play or Handling Credits
    Dim bOnTheFirstBall			' First Ball (player one). Used for Adding New Players
    Dim bBallInPlungerLane		' is there a ball in the plunger lane
    Dim bBallSaverActive			' is the ball saver active 
    Dim bMultiBallMode			' multiball mode active ?
    Dim bEnteringAHighScore		' player is entering their name into the high score table
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **               Future Pinball Defined Script Events              **
    ' **                                                                 **
    ' *********************************************************************
     
     
    ' The Method Is Called Immediately the Game Engine is Ready to 
    ' Start Processing the Script.
    '
    Sub FuturePinball_BeginPlay()
    	' seed the randomiser (rnd(1) function)
    	Randomize
     
    	' initalise the player display reel to the last known player scores 
    	Player1Reel.SetValue(nvScore1)
    	Player2Reel.SetValue(nvScore2)
    	Player3Reel.SetValue(nvScore3)
    	Player4Reel.SetValue(nvScore4)
     
    	' We want the player to put in credits (Change this 
    	bFreePlay = FALSE
     
    	' kill the last switch hit (this this variable is very usefull for game control)
    	set LastSwitchHit = DummyTrigger
     
    	' initialse any other flags
    	bOnTheFirstBall = FALSE
    	bEnteringAHighScore	= FALSE
    	BallsOnPlayfield = 0
    	BallsInLock	= 0
     
    	EndOfGame()
    End Sub
     
     
    ' This Method is Called when the user has exited the Game Player. It should
    ' save any RAM variables that need to be persistant.
    '
    Sub FuturePinball_EndPlay()
    End Sub
     
     
    ' The User Has Pressed A Key on the Keyboard..
    '
    Sub FuturePinball_KeyPressed(ByVal KeyCode)
    	'AddDebugText "KeyCode = " & KeyCode
    	'AddDebugText "Titled = " & fpTilted
    	'
    	' Process any keys which are valid at all times
    	'
     
    	' The Player has Inserted a Coin
    	If (KeyCode = GetKeyCode(InsertCoinKey)) Then
    		PlaySound "CoinIn"
    		nvCredits = nvCredits + 1
    		'AddDebugText "Insert Coin, Credits = " & nvCredits
    		' If not Tilted, then give some feed back to the player
    		If (fpTilted = FALSE) Then
    			' Flash the Slingshot Bulbs. This is rather Common on Pinball machines
    			' though you can do anything at this point
    			LeftSlingshotBulb1.FlashForMs  200, 100, BulbOff
    			LeftSlingshotBulb2.FlashForMs  200, 100, BulbOff
    			RightSlingshotBulb1.FlashForMs 200, 100, BulbOff
    			RightSlingshotBulb2.FlashForMs 200, 100, BulbOff
    			' Maybe play a sound at this point or put something on the display
    		End If
    	End If
     
    	' The Player is Pulling back the Plunger
    	If (KeyCode = GetKeyCode(PlungerKey)) Then
    		Plunger.Pull
    	End If
     
     
    	'
    	' Process The Next set of keys depeding of wether there is a game in progress or not
    	'
     
    	' Is A Game in Progress?
    	If (fpGameInPlay = TRUE) Then
    		' and not Tilted ?
    		If (fpTilted = FALSE) Then
     
    			' If the Left Flipper Key Has Been Press, Activate The Left Flipper(s)
    			If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
    				LeftFlipper.SolenoidOn
    				PlaySound "Flipper"
    			End If
     
    			' If the Right Flipper Key Has Been Press, Activate The Right Flipper(s)
    			If (KeyCode = GetKeyCode(RightFlipperKey)) Then
    				RightFlipper.SolenoidOn
    				PlaySound "Flipper"
    			End If
     
    			' Another player starting?
    			If (KeyCode = GetKeyCode(StartGameKey)) Then
    				' must be less than max players and must be on the the very first ball of the game
    				If ((PlayersPlayingGame < constMaxPlayers) And (bOnTheFirstBall = TRUE)) Then
    					' free play or credits
    					If (bFreePlay = TRUE) Then
    						' add the extra player
    						PlayersPlayingGame = PlayersPlayingGame + 1
    						'AddDebugText "Extra Player (Free Play)" & PlayersPlayingGame
    						' Update the stats
    						nvTotalGamesPlayed = nvTotalGamesPlayed + 1
    					Else
    						If (nvCredits > 0) then
    							PlayersPlayingGame = PlayersPlayingGame + 1
    							'AddDebugText "Extra Player (Credits)" & PlayersPlayingGame
    							' update the stats
    							nvTotalGamesPlayed = nvTotalGamesPlayed + 1
    							nvCredits = nvCredits - 1
    						Else
    							' Not Enough Credits to start a game.  
    							' Maybe Play a Sound or put "Insert Coin" on a display
    						End If
    					End If
    				End If
    			End If
    		End If ' If (fpTilted)
     
    	Else	' If (fpGameInPlay)
     
    		' there isn't a game in play (we are in the attract mode)
          ' wait for the start key to be pressed and start a new game
          If (KeyCode = GetKeyCode(StartGameKey)) Then
    			' Free Play Mode ?
    			If (bFreePlay = TRUE) Then
    				' Yep.  Only allow a game to Start if there are no balls on the playfield.
    				' This can happen if the player starts a game too quick after finishing the
    				' last game and the machine is ejecting any locked balls.
    				If (BallsOnPlayfield = 0) Then
    					' A Game is now in progress, reset the table for a new Game
    					ResetForNewGame()
    				End If
    			Else
    				' paying by credits, do we have any ?
    				If (nvCredits > 0) Then
    					' Yep.  Only allow a game to start if there are no balls on the playfield
    					If (BallsOnPlayfield = 0) Then
    						' remove a credit
    						nvCredits = nvCredits - 1
    						' much the same as above
    						ResetForNewGame()
    					End If
    				Else
    					' Not Enough Credits to start a game.  
    					' Maybe Play a Sound or put "Insert Coin" on a display
    				End If
    			End If
    		End If
     
    	End If ' If (fpGameInPlay)
    End Sub
     
     
    ' The User Has Released A Key on the Keyboard..
    '
    Sub FuturePinball_KeyReleased(ByVal KeyCode)
     
    	'
    	' Process any keys which are valid at all times
    	'
     
    	' The Player has released the Plunger, Let it go..
    	If (KeyCode = GetKeyCode(PlungerKey)) Then
    		Plunger.LetGo
    		PlaySound "PlungerRelease"
    	End If
     
    	'
    	' Process The Next set of keys depeding of wether there is a game in progress or not
    	'
     
    	' Is A Game in Progress?
    	If (fpGameInPlay = TRUE) Then
    		' and not tilted
    		If (fpTilted = FALSE) Then
     
    			' The Left Flipper Key has been released, Turn Off the Left Flipper(s)
    			If (KeyCode = GetKeyCode(LeftFlipperKey)) Then
    				LeftFlipper.SolenoidOff
    			End If
     
    			' The Right Flipper Key has been released, Turn Off the Right Flipper(s)
    			If (KeyCode = GetKeyCode(RightFlipperKey)) Then
    				RightFlipper.SolenoidOff
    			End If
    		End If
    	End If
    End Sub
     
     
    ' The User Has Paused The Game.. 
    '
    Sub FuturePinball_Paused()
    End Sub
     
     
    ' The User Has UnPaused (Resumed) The Game.. 
    '
    Sub FuturePinball_UnPaused()
    End Sub
     
     
    ' The Played has Nudged the Table a little too hard/much and a Warning
    ' must be given to the player
    '
    Sub FuturePinball_TiltWarning(ByVal Warnings)
    	'AddDebugText "Tilt Warning" & Warnings
     
    	' play a sound at this point and put something on a display
    End Sub
     
     
    ' The Player has tilted the machine (Too Many Warnings)
    '
    Sub FuturePinball_Tilted()
    	'AddDebugText "**Tilted**"
     
    	' play a sound
    	PlaySound "Tilt"
     
    	' ensure that the flippers are down (as the keys won't work from now on)
    	LeftFlipper.SolenoidOff
    	RightFlipper.SolenoidOff
     
    	' you may wish to turn off any lights at this point. (The Light Sequencer
    	' will make this very easy)
     
    	' start the tilt recovery timer which waits until all balls have drained
    	' before doing the end of ball sequence (or end of game)
    	TiltRecoveryTimer.Interval = 2000
    	TiltRecoveryTimer.Enabled	= TRUE
    End Sub
     
     
    ' A Music Channel has finished Playing. 
    '
    ' Channel is set to the channel number that has finished.
    '
    Sub FuturePinball_MusicFinished(ByVal Channel)
    End Sub
     
     
    ' High Score entry has been completed by the player. 
    '
    ' Position is set to the position in the high score table (1 - 4)
    ' if it is set to 0 then there was no new High Score
    '
    ' Special is set to 1 if the Special High Score was beaten
    '
    Sub FuturePinball_NameEntryComplete(ByVal Position, ByVal Special)
    	' has the player beaten a high score
    	If (Position <> 0) Then
    		' maybe award something (like an extra credit) based on the high score position
    	End If
     
    	' has the player beaten the special score (if applicable)
    	If (Special <> 0) Then
    	End If
     
    	bEnteringAHighScore = FALSE
     
    	' check to see if there are any more players playing to the current game
    	EndOfBallComplete()
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                     User Defined Script Events                  **
    ' **                                                                 **
    ' *********************************************************************
     
    ' Initialise the Table for a new Game
    '
    Sub ResetForNewGame()
    	Dim	i
     
    	'AddDebugText "ResetForNewGame"
     
    	' get Future Pinball to zero out the nvScore (and nvSpecialScore) Variables
    	' aswell and ensure the camera is looking in the right direction.
    	' this also Sets the fpGameInPlay flag
    	BeginGame()
     
    	Player1Reel.ResetToZero
    	Player2Reel.ResetToZero
    	Player3Reel.ResetToZero
    	Player4Reel.ResetToZero
     
    	' increment the total number of games played
       nvTotalGamesPlayed = nvTotalGamesPlayed + 1
     
    	' Start with player 1
    	CurrentPlayer = 1
     
    	' Single player (for now, more can be added in later)
    	PlayersPlayingGame = 1
     
    	' We are on the First Ball (for Player One)
    	bOnTheFirstBall = TRUE
     
    	' initialise all the variables which are used for the duration of the game
    	' (do all players incase any new ones start a game)
    	For i = 1 To constMaxPlayers
    		' Bonus Points for the current player
    		BonusPoints(i)	= 0
    		' Initial Bonus Multiplier
    		BonusMultiplier(i) = 1
    		' Balls Per Game
    		BallsRemaining(i) = nvBallsPerGame 
    		' Number of EB's out-standing
    		ExtraBallsAwards(i) = 0
    	Next
     
    	' initialise any other flags
    	bMultiBallMode = FALSE
     
    	' you may wish to start some music, play a sound, do whatever at this point
     
    	' set up the start delay to handle any Start of Game Attract Sequence
    	FirstBallDelayTimer.Interval = 500
    	FirstBallDelayTimer.Enabled = TRUE
    End Sub
     
     
    ' This Timer is used to delay the start of a game to allow any attract sequence to 
    ' complete.  When it expires it creates a ball for the player to start playing with
    '
    Sub FirstBallDelayTimer_Expired()
    	' stop the timer
    	FirstBallDelayTimer.Enabled = FALSE
     
    	' reset the table for a new ball
    	ResetForNewPlayerBall()
     
    	' create a new ball in the shooters lane
    	CreateNewBall()
    End Sub
     
     
    ' (Re-)Initialise the Table for a new ball (either a new ball after the player has 
    ' lost one or we have moved onto the next player (if multiple are playing))
    '
    Sub ResetForNewPlayerBall()
    	' make sure the correct display is upto date
    	AddScore(0)
     
    	' set the current players bonus multiplier back down to 1X
    	SetBonusMultiplier(1)
     
    	' reset any drop targets, lights, game modes etc..
    	ShootAgainLight.State = BulbOff
    End Sub
     
     
    ' Create a new ball on the Playfield
    '
    Sub CreateNewBall()
    	' create a ball in the plunger lane kicker.
    	PlungerKicker.CreateBall
     
    	' There is a (or another) ball on the playfield
    	BallsOnPlayfield = BallsOnPlayfield + 1
     
    	' kick it out..
    	PlungerKicker.SolenoidPulse
    End Sub
     
     
    ' The Player has lost his ball (there are no more balls on the playfield).
    ' Handle any bonus points awarded
    '
    Sub EndOfBall()
    	Dim BonusDelayTime
     
    	'AddDebugText "EndOfBall"
     
    	' the first ball has been lost. From this point on no new players can join in
    	bOnTheFirstBall = FALSE
     
    	' only process any of this if the table is not tilted.  (the tilt recovery 
    	' mechanism will handle any extra balls or end of game)
    	If (fpTilted = FALSE) Then
    		Dim AwardPoints
     
    		' add in any bonus points (multipled by the bunus multiplier)
    		AwardPoints = BonusPoints(CurrentPlayer) * BonusMultiplier(CurrentPlayer)
    		AddScore(AwardPoints)
    		'AddDebugText "Bonus Points = " & AwardPoints
     
    		' you may wish to do some sort of display effects which the bonus is 
    		' being added to the players score
     
    		' add a bit of a delay to allow for the bonus points to be added up
    		BonusDelayTime = 1000
    	Else
    		' no bonus, so move to the next state quickly
    		BonusDelayTime = 20
    	End If
     
    	' start the end of ball timer which allows you to add a delay at this point
    	EndOfBallTimer.Interval = BonusDelayTime
    	EndOfBallTimer.Enabled = TRUE
    End Sub
     
     
    ' The Timer which delays the machine to allow any bonus points to be added up
    ' has expired.  Check to see if there are any extra balls for this player.
    ' if not, then check to see if this was the last ball (of the currentplayer)
    '
    Sub EndOfBallTimer_Expired()
    	' disable the timer
    	EndOfBallTimer.Enabled = FALSE
     
    	' if were tilted, reset the internal tilted flag (this will also 
    	' set fpTiltWarnings back to zero) which is useful if we are changing player LOL
    	fpTilted = FALSE
     
    	' has the player won an extra-ball ? (might be multiple outstanding)
    	If (ExtraBallsAwards(CurrentPlayer) <> 0) Then
     
    		'AddDebugText "Extra Ball"
     
    		' yep got to give it to them
    		ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) - 1
     
    		' if no more EB's then turn off any shoot again light
    		If (ExtraBallsAwards(CurrentPlayer) = 0) Then
    			ShootAgainLight.State = BulbOff
    		End If
     
    		' You may wish to do a bit of a song and dance at this point
     
    		' Create a new ball in the shooters lane
    		CreateNewBall()
     
    	Else	' no extra balls
     
    		BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer) - 1
     
    		' was that the last ball ?
    		If (BallsRemaining(CurrentPlayer) <= 0) Then
     
    			'AddDebugText "No More Balls, High Score Entry"
     
    			' Submit the currentplayers score to the High Score system built into Future Pinball
    			' if they have gotten a high score then it will ask them for their initials.  If not
    			' it will call the FuturePinball_NameEntryComplete right away
    			bEnteringAHighScore = TRUE
    			EnterHighScore(CurrentPlayer)
    			' you may wish to play some music at this point
     
    		Else
     
    			' not the last ball (for that player)
    			' if multiple players are playing then move onto the next one
    			EndOfBallComplete()
     
    		End If
    	End If
    End Sub
     
     
    ' This function is called when the end of bonus display
    ' (or high score entry finished) and it either end the game or
    ' move onto the next player (or the next ball of the same player)
    '
    Sub EndOfBallComplete()
      Dim NextPlayer
     
    	'AddDebugText "EndOfBall - Complete"
     
    	' are there multiple players playing this game ?
    	If (PlayersPlayingGame > 1) Then
    		' then move to the next player
    		NextPlayer = CurrentPlayer + 1
    		' are we going from the last player back to the first
    		' (ie say from player 4 back to player 1)
    		If (NextPlayer > PlayersPlayingGame) Then
    			NextPlayer = 1
    		End If
    	Else
    		NextPlayer = CurrentPlayer
    	End If
     
    	'AddDebugText "Next Player = " & NextPlayer
     
       ' is it the end of the game ? (all balls been lost for all players)
    	If ((BallsRemaining(CurrentPlayer) <= 0) And (BallsRemaining(NextPlayer) <= 0)) Then
    		' you may wish to do some sort of Point Match free game award here
    		' generally only done when not in free play mode
     
    		' set the machine into game over mode
          EndOfGame()
     
    		' you may wish to put a Game Over message on the 
     
    	Else
    		' set the next player
    		CurrentPlayer = NextPlayer
     
    		' make sure the correct display is upto date
    		AddScore(0)
     
    		' reset the playfield for the new player (or new ball)
    		ResetForNewPlayerBall()
     
    		' and create a new ball
    		CreateNewBall()
     
    	End If
    End Sub
     
     
    ' This frunction is called at the End of the Game, it should reset all
    ' Drop targets, and eject any 'held' balls, start any attract sequences etc..
    Sub EndOfGame()
    	'AddDebugText "End Of Game"
     
    	' let Future Pinball know that the game has finished.  
    	' This also clear the fpGameInPlay flag.
    	EndGame()
     
    	' ensure that the flippers are down
    	LeftFlipper.SolenoidOff
    	RightFlipper.SolenoidOff
     
    	' turn off the reel bulbs
    	Player1Reel.State = BulbOff
    	Player2Reel.State = BulbOff
    	Player3Reel.State = BulbOff
    	Player4Reel.State = BulbOff
     
    	' set any lights for the attract mode
    	SetAllLightsForAttractMode()
     
    	' you may wish to light any Game Over Light you may have
    End Sub
     
     
    ' The tilt recovery timer waits for all the balls to drain before continuing on 
    ' as per normal
    '
    Sub TiltRecoveryTimer_Expired()
    	' disable the timer
    	TiltRecoveryTimer.Enabled	= FALSE
    	' if all the balls have been drained then..
    	If (BallsOnPlayfield = 0) Then
    		' do the normal end of ball thing (this dosn't give a bonus if the table is tilted)
    		EndOfBall()
    	Else
    		' else retry (checks again in another second)
    		TiltRecoveryTimer.Interval = 1000
    		TiltRecoveryTimer.Enabled = TRUE
    	End If
    End Sub
     
     
    ' Set any lights for the Attract Mode.
    '
    Sub SetAllLightsForAttractMode()
    	ShootAgainLight.State = BulbBlink
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                   Drain / Plunger Functions                     **
    ' **                                                                 **
    ' *********************************************************************
     
    ' lost a ball ;-( check to see how many balls are on the playfield.
    ' if only one then decrement the remaining count and test for End of game
    ' if more than 1 ball (multi-ball) then kill of the ball but don't create
    ' a new one
    '
    Sub Drain_Hit()
    	' Destroy the ball
    	Drain.DestroyBall
    	BallsOnPlayfield = BallsOnPlayfield - 1
    	' pretend to knock the ball into the ball storage mech
    	PlaySound "Drain"
     
    	' if there is a game in progress and 
    	If (fpGameInPlay = TRUE) And (fpTilted = FALSE) Then
     
    		' is the ball saver active,
    		If (bBallSaverActive = TRUE) Then
     
    			' yep, create a new ball in the shooters lane
    			CreateNewBall()
    			' you may wish to put something on a display or play a sound at this point
     
    		Else
     
    			' cancel any multiball if on last ball (ie. lost all other balls)
    			'
    			If (BallsOnPlayfield = 1) Then
    				' and in a multi-ball??
    				If (bMultiBallMode = True) then
    					' not in multiball mode any more
    					bMultiBallMode = False
    					' you may wish to change any music over at this point and
    					' turn off any multiball specific lights
    				End If
    			End If
     
    			' was that the last ball on the playfield
    			If (BallsOnPlayfield = 0) Then
    				' handle the end of ball (change player, high score entry etc..)
    				EndOfBall()
    			End If
     
    		End If
    	End If
    End Sub
     
     
    ' A ball is pressing down the trigger in the shooters lane
    '
    Sub PlungerLaneTrigger_Hit()
    	bBallInPlungerLane = TRUE
     
    	' remember last trigger hit by the ball
    	set LastSwitchHit = PlungerLaneTrigger
    End Sub
     
     
    ' A Ball may of rolled into the Plunger Lane Kicker, if so then kick it 
    ' back out again
    '
    Sub PlungerKicker_Hit()
    	PlungerKicker.SolenoidPulse
    End Sub
     
     
    ' The Ball has rolled out of the Plunger Lane.  Check to see if a ball saver machanisim
    ' is needed and if so fire it up.
    '
    Sub PlungerLaneGate_Hit()
    	' if there is a need for a ball saver, then start off a timer
    	' only start if it is currently not running, else it will reset the time period
    	If (constBallSaverTime <> 0) And (bBallSaverActive <> TRUE) Then
    		' and only if the last trigger hit was the plunger wire. 
    		' (ball in the shooters lane)
    		If (LastSwitchHit.Name = "PlungerLaneTrigger") Then
    			' set our game flag
    			bBallSaverActive = TRUE
    			' start the timer
    			BallSaverTimer.Enabled = FALSE
    			BallSaverTimer.Interval = constBallSaverTime
    			BallSaverTimer.Enabled = TRUE
    			' if you have a ball saver light you might want to turn it on at this 
    			' point (or make it flash)
    		End If
    	End If
    End Sub
     
     
    ' The ball saver timer has expired.  Turn it off and reset the game flag
    '
    Sub BallSaverTimer_Expired()
    	' stop the timer from repeating
    	BallSaverTimer.Enabled = FALSE
    	' clear the flag
    	bBallSaverActive = FALSE
    	' if you have a ball saver light then turn it off at this point
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                   Supporting Score Functions                    **
    ' **                                                                 **
    ' *********************************************************************
     
    ' Add points to the score and update the score board
    '
    Sub AddScore(points)
    	If (fpTilted = FALSE) Then
    		' add the points to the current players score variable
    		nvScore(CurrentPlayer) = nvScore(CurrentPlayer) + points
     
    		' update the score displays
     
    		Player1Reel.State = BulbOff
    		Player2Reel.State = BulbOff
    		Player3Reel.State = BulbOff
    		Player4Reel.State = BulbOff
     
    		' add the points to the correct display and light the current players display
    		Select Case (CurrentPlayer)
    			Case 1:	Player1Reel.AddValue(points)
    						Player1Reel.State = BulbOn
     
    			Case 2:	Player2Reel.AddValue(points)
    						Player2Reel.State = BulbOn
     
    			Case 3:	Player3Reel.AddValue(points)
    						Player3Reel.State = BulbOn
     
    			Case 4:	Player4Reel.AddValue(points)
    						Player4Reel.State = BulbOn
    		End Select
    	End if
     
    	' you may wish to check to see if the player has gotten a replay
    End Sub
     
     
    ' Add some points to the current Jackpot.
    '
    Sub AddJackpot(points)
    	' Jackpots only generally increment in multiball mode and not tilted
    	' but this dosn't have to tbe the case
    	If (fpTilted = False) Then
     
    		If (bMultiBallMode = TRUE) Then
    			nvJackpot = nvJackpot + points
    			' you may wish to limit the jackpot to a upper limit, ie..
    			'	If (nvJackpot >= 6000) Then
    			'		nvJackpot = 6000
    			' 	End if
    		End if
    	End if
    End Sub
     
     
    ' Will increment the Bonus Multiplier to the next level
    '
    Sub IncrementBonusMultiplier()
    	Dim NewBonusLevel
     
    	' if not at the maximum bonus level
    	if (BonusMultiplier(CurrentPlayer) < constMaxMultiplier) then
    		' then set it the next next one and set the lights
    		NewBonusLevel = BonusMultiplier(CurrentPlayer) + 1
    		SetBonusMultiplier(NewBonusLevel)
       End if
    End Sub
     
     
    ' Set the Bonus Multiplier to the specified level and set any lights accordingly
    '
    Sub SetBonusMultiplier(Level)
    	' Set the multiplier to the specified level
    	BonusMultiplier(CurrentPlayer) = Level
     
    	' If the multiplier is 1 then turn off all the bonus lights
    	If (BonusMultiplier(CurrentPlayer) = 1) Then
    		' insert your own code here
    	Else
    		' there is a bonus, turn on all the lights upto the current level
    		If (BonusMultiplier(CurrentPlayer) >= 2) Then
    			' insert your own code here
    		End If
    		' etc..
    	End If
    End Sub
     
     
     
    ' *********************************************************************
    ' **                                                                 **
    ' **                     Table Object Script Events                  **
    ' **                                                                 **
    ' *********************************************************************
     
    ' The Left Slingshot has been Hit, Add Some Points and Flash the Slingshot Lights
    '
    Sub LeftSlingshotRubber_Hit()
    	' add some points
    	AddScore(5)
    	' flash the lights around the slingshot
    	LeftSlingshotBulb1.FlashForMs 100, 50, BulbOff
    	LeftSlingshotBulb2.FlashForMs 100, 50, BulbOff
    End Sub
     
     
    ' The Right Slingshot has been Hit, Add Some Points and Flash the Slingshot Lights
    '
    Sub RightSlingshotRubber_Hit()
    	' add some points
    	AddScore(5)
    	' flash the lights around the slingshot
    	RightSlingshotBulb1.FlashForMs 100, 50, BulbOff
    	RightSlingshotBulb2.FlashForMs 100, 50, BulbOff
    End Sub
     
     
    ' The Left InLane trigger has been Hit
    '
    Sub LeftInLaneTrigger_Hit()
    	' add some points
    	AddScore(1)
    	' remember last trigger hit by the ball
    	set LastSwitchHit = LeftInLaneTrigger
    End Sub
     
     
    ' The Right InLane trigger has been Hit
    '
    Sub RightInLaneTrigger_Hit()
    	' add some points
    	AddScore(1)
    	' remember last trigger hit by the ball
    	set LastSwitchHit = RightInLaneTrigger
    End Sub
     
     
    ' The Left OutLane trigger has been Hit
    '
    Sub LeftOutLaneTrigger_Hit()
    	' add some points
    	AddScore(10)
    	' remember last trigger hit by the ball
    	set LastSwitchHit = LeftOutLaneTrigger
    End Sub
     
     
    ' The Right OutLane trigger has been Hit
    '
    Sub RightOutLaneTrigger_Hit()
    	' add some points
    	AddScore(10)
    	' remember last trigger hit by the ball
    	set LastSwitchHit = RightOutLaneTrigger
    End Sub

  2. #2
    Expert éminent
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 741
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 741
    Par défaut
    Salut,

    Si vous n'avez pas un programme qui sache traduire ce langage là en Python, il va falloir faire la traduction par vous même... (en connaissant les subtilités du langage de départ et celle du langage d'arrivée).

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

  3. #3
    Membre Expert
    Avatar de MPython Alaplancha
    Homme Profil pro
    Paysan à 3 francs six sous
    Inscrit en
    Juin 2018
    Messages
    923
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pyrénées Orientales (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Paysan à 3 francs six sous
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Juin 2018
    Messages : 923
    Billets dans le blog
    8
    Par défaut
    Bonjour,
    ...
    à défaut d'une équivalence du programme proposé, tu trouveras des jeux Pinball écrit en python en écrivant sur ton moteur de recherche : pinball python

Discussions similaires

  1. Equivalent recherchev Python
    Par Mrgx52 dans le forum Général Python
    Réponses: 20
    Dernier message: 05/02/2019, 11h45
  2. fitgmdist equivalent pour python
    Par lilington dans le forum Calcul scientifique
    Réponses: 0
    Dernier message: 21/03/2017, 04h02
  3. Equivalent de "PAUSE" en Python ?
    Par Lenezir dans le forum Général Python
    Réponses: 12
    Dernier message: 16/08/2011, 11h05
  4. [WxRuby] Equivalent python de CheckListCTRL
    Par Jeremy0201 dans le forum Ruby
    Réponses: 0
    Dernier message: 09/01/2009, 12h05
  5. Equivalent à sleep en python
    Par breakwall dans le forum Général Python
    Réponses: 3
    Dernier message: 09/10/2008, 15h28

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo