Jeux mario

Description

Public Class stage2

'mario déclaré en global
Dim monMario As Class1
Dim box1 As Class1

Dim box2 As Class1
Dim box3 As Class1

Dim panel(0 To 11) As Object
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown


Select Case e.KeyCode
'************************************déplacement vers le haut*********************************
Case Keys.Z
My.Computer.Audio.Play(My.Resources.jump, AudioPlayMode.Background) 'sound*****************
If Panel1.Location.X = Panel11.Location.X And Panel1.Location.Y = Panel11.Location.Y + 60 Then

box1.pousser_haut()
monMario.Monte()
ElseIf Panel1.Location.X = Panel2.Location.X And Panel1.Location.Y = Panel2.Location.Y + 60 Then

box2.pousser_haut()
monMario.Monte()
ElseIf Panel1.Location.X = Panel6.Location.X And Panel1.Location.Y = Panel6.Location.Y + 60 Then
box3.pousser_haut()
monMario.Monte()
ElseIf Panel1.Location.Y = 2 Then
monMario.fiy()
ElseIf Panel1.Location.X = 360 And Panel1.Location.Y = 122 Then
monMario.fiy()
ElseIf Panel1.Location.X = 300 And Panel1.Location.Y = 122 Then
monMario.Monte()
My.Computer.Audio.Play(My.Resources.burned, AudioPlayMode.Background)

GroupBox2.Visible = True

Else
monMario.Monte()

End If

Panel1.BackgroundImage = My.Resources.mario_a

'********************************déplacement vers le bas********************************
Case Keys.S
My.Computer.Audio.Play(My.Resources.jump, AudioPlayMode.Background) ' sound************
If Panel1.Location.X = Panel11.Location.X And Panel1.Location.Y = Panel11.Location.Y - 60 Then
box1.pousser_bas()

monMario.Descend()

ElseIf Panel1.Location.X = Panel2.Location.X And Panel1.Location.Y = Panel2.Location.Y - 60 Then

box2.pousser_bas()
monMario.Descend()
ElseIf Panel1.Location.X = Panel6.Location.X And Panel1.Location.Y = Panel6.Location.Y - 60 Then
box3.pousser_bas()
monMario.Descend()

ElseIf Panel1.Location.X = 300 And Panel1.Location.Y = 2 Then
My.Computer.Audio.Play(My.Resources.burned, AudioPlayMode.Background)
monMario.Descend()
MsgBox("Game over")
ElseIf Panel1.Location.Y = 362 Then
monMario.fiy()
Else

monMario.Descend()

End If

Panel1.BackgroundImage = My.Resources.mario_d

'******************************************déplacement a gauche****************************
Case Keys.Q

My.Computer.Audio.Play(My.Resources.jump, AudioPlayMode.Background) 'sound*************

If Panel1.Location.Y = Panel11.Location.Y And Panel1.Location.X = Panel11.Location.X + 60 Then

box1.pousser_arriere()

monMario.Recule()
ElseIf Panel1.Location.Y = Panel2.Location.Y And Panel1.Location.X = Panel2.Location.X + 60 Then

box2.pousser_arriere()
monMario.Recule()
ElseIf Panel1.Location.Y = Panel6.Location.Y And Panel1.Location.X = Panel6.Location.X + 60 Then
box3.pousser_arriere()
monMario.Recule()

ElseIf Panel1.Location.X = 0 Then
monMario.fix()
ElseIf Panel1.Location.X = 420 And Panel1.Location.Y = 2 Or Panel1.Location.X = 420 And Panel1.Location.Y = 62 Then
monMario.fix()

Else
monMario.Recule()
End If
Panel1.BackgroundImage = My.Resources.mario_l
'*********************************déplacement à droit****************************************************
Case Keys.D
My.Computer.Audio.Play(My.Resources.jump, AudioPlayMode.Background)
If Panel1.Location.Y = Panel11.Location.Y And Panel1.Location.X = Panel11.Location.X - 60 Then
box1.pousser()

monMario.avance()

ElseIf Panel1.Location.Y = Panel2.Location.Y And Panel1.Location.X = Panel2.Location.X - 60 Then
box2.pousser()

monMario.avance()
ElseIf Panel1.Location.Y = Panel6.Location.Y And Panel1.Location.X = Panel6.Location.X - 60 Then
box3.pousser()

monMario.avance()

ElseIf Panel1.Location.X = 300 And Panel1.Location.Y = 2 Then
monMario.fix()
ElseIf Panel1.Location.X = 240 And Panel1.Location.Y = 62 Then
monMario.avance()
My.Computer.Audio.Play(My.Resources.burned, AudioPlayMode.Background)

GroupBox2.Visible = True
Else
monMario.avance()

End If
Panel1.BackgroundImage = My.Resources.mario_r
Case Else

If Panel1.Location.X = 240 Then
monMario.fix()

End If

End Select
Me.Panel1.Location = monMario.position
Me.Panel11.Location = box1.position
Me.Panel2.Location = box2.position
Me.Panel6.Location = box3.position

'*************************************************************finich***********************************************************

If Panel11.Location.X = tr1.Location.X And Panel11.Location.Y = tr1.Location.Y And Panel2.Location.X = tr2.Location.X And Panel2.Location.Y = tr2.Location.Y And Panel6.Location.X = tr3.Location.X And Panel6.Location.Y = tr3.Location.Y Then

My.Computer.Audio.Play(My.Resources.mario1, _
AudioPlayMode.Background)
active()
End If

End Sub

Public Sub cadre()

If Panel1.Location.X = 0 Or Panel1.Location.X = 540 Then
monMario.fix()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.KeyPreview = True
monMario = New Class1(Me.Panel1.Location, Me.Panel1.Size)
box1 = New Class1(Me.Panel11.Location, Me.Panel11.Size)
box2 = New Class1(Me.Panel2.Location, Me.Panel2.Size)
box3 = New Class1(Me.Panel6.Location, Me.Panel6.Size)

desactive()

panel(0) = m1
panel(1) = m2
panel(2) = m3
panel(3) = m4
panel(4) = m5
panel(5) = m6
panel(6) = m7
panel(7) = m8
panel(8) = m9

panel(9) = m10
panel(10) = m11
panel(11) = m12
End Sub
Public Sub active()

GroupBox1.Visible = True
Panel1.Visible = False
Panel11.Visible = False
Panel2.Visible = False
tr1.Visible = False
tr2.Visible = False

End Sub
Public Sub desactive()
GroupBox1.Visible = False
GroupBox2.Visible = False
End Sub


End Class

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.

Du même auteur (A.rebai)