Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 14:33

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



vb.net - problem im code

Discussion on vb.net - problem im code within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
waldi_'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 440
Received Thanks: 352
vb.net - problem im code

Hey Leute
Um mich ein bisschen in XNA und Visual Basic umzuschauen hab ich versucht das Platform Game - Beispiel von C# XNA Game Studio zu übersetzen (gibt im inet en übersetzer, is recht leicht weil ja beide codes in einen gleichen zwischencode übersetzt werden beim compilieren)

so, nun hab ich alle klasen übersetzt und hinzugefügt, zeigt auch keine fehler an außer bei einer Zeile:

Code:
Imports System
Imports Microsoft.Xna.Framework
Imports Microsoft.Xna.Framework.Graphics

Namespace Platformer1
    ''' <summary>
    ''' Controls playback of an Animation.
    ''' </summary>
    Structure AnimationPlayer
        ''' <summary>
        ''' Gets the animation which is currently playing.
        ''' </summary>
        Public ReadOnly Property Animation() As Animation
            Get
                Return m_animation
            End Get
        End Property
        Private m_animation As Animation

        ''' <summary>
        ''' Gets the index of the current frame in the animation.
        ''' </summary>
        Public ReadOnly Property FrameIndex() As Integer
            Get
                Return m_frameIndex
            End Get
        End Property
        Private m_frameIndex As Integer

        ''' <summary>
        ''' The amount of time in seconds that the current frame has been shown for.
        ''' </summary>
        Private time As Single

        ''' <summary>
        ''' Gets a texture origin at the bottom center of each frame.
        ''' </summary>
        Public ReadOnly Property Origin() As Vector2
            Get
                Return New Vector2(Animation.FrameWidth / 2.0F, Animation.FrameHeight)
            End Get
        End Property

        ''' <summary>
        ''' Begins or continues playback of an animation.
        ''' </summary>
        Public Sub PlayAnimation(ByVal animation__1 As Animation)
            ' If this animation is already running, do not restart it.
            If [COLOR="Red"]animation__1 = animation[/COLOR] Then
                Exit Sub
            End If

            ' Start the new animation.
            Me.m_animation = animation__1
            Me.m_frameIndex = 0
            Me.time = 0.0F
        End Sub

        ''' <summary>
        ''' Advances the time position and draws the current frame of the animation.
        ''' </summary>
        Public Sub Draw(ByVal gameTime As GameTime, ByVal spriteBatch As SpriteBatch, ByVal position As Vector2, ByVal spriteEffects As SpriteEffects)
            If Animation Is Nothing Then
                Throw New NotSupportedException("No animation is currently playing.")
            End If

            ' Process passing time.
            time += CSng(gameTime.ElapsedGameTime.TotalSeconds)
            While time > Animation.FrameTime
                time -= Animation.FrameTime

                ' Advance the frame index; looping or clamping as appropriate.
                If Animation.IsLooping Then
                    m_frameIndex = (m_frameIndex + 1) Mod Animation.FrameCount
                Else
                    m_frameIndex = Math.Min(m_frameIndex + 1, Animation.FrameCount - 1)
                End If
            End While

            ' Calculate the source rectangle of the current frame.
            Dim source As New Rectangle(FrameIndex * Animation.Texture.Height, 0, Animation.Texture.Height, Animation.Texture.Height)

            ' Draw the current frame.
            spriteBatch.Draw(Animation.Texture, position, source, Color.White, 0.0F, Origin, _
             1.0F, spriteEffects, 0.0F)
        End Sub
    End Structure
End Namespace
Das Rote ist der Fehler, hier die Fehlerbeschreibung:
Der =-Operator ist für die Typen "Spiel1.Platformer1.Animation" und "Spiel1.Platformer1.Animation" nicht definiert.

Animation is ne Klasse..

hat jemand ne idee an was es liegen könnte?
ich will eig nur das der code funktioniert um ihn dann genauer anzuschauen :o
waldi_ is offline  
Old 03/16/2010, 21:42   #2
 
xNopex's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 827
Received Thanks: 471
Versuch mal das für die rote Zeile:

Code:
If animation__1 = Me.m_animation Then
Wäre für mich jetzt am logischsten, nachdem ich kurz über den Code geschaut hab.
xNopex is offline  
Old 03/16/2010, 21:45   #3
 
waldi_'s Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 440
Received Thanks: 352
geht auch nich :/


Hier der Code von der klasse animation:

Code:
Imports System
Imports Microsoft.Xna.Framework.Graphics

Namespace Platformer1
    ''' <summary>
    ''' Represents an animated texture.
    ''' </summary>
    ''' <remarks>
    ''' Currently, this class assumes that each frame of animation is
    ''' as wide as each animation is tall. The number of frames in the
    ''' animation are inferred from this.
    ''' </remarks>
    Class Animation
        ''' <summary>
        ''' All frames in the animation arranged horizontally.
        ''' </summary>
        Public ReadOnly Property Texture() As Texture2D
            Get
                Return m_texture
            End Get
        End Property
        Private m_texture As Texture2D

        ''' <summary>
        ''' Duration of time to show each frame.
        ''' </summary>
        Public ReadOnly Property FrameTime() As Single
            Get
                Return m_frameTime
            End Get
        End Property
        Private m_frameTime As Single

        ''' <summary>
        ''' When the end of the animation is reached, should it
        ''' continue playing from the beginning?
        ''' </summary>
        Public ReadOnly Property IsLooping() As Boolean
            Get
                Return m_isLooping
            End Get
        End Property
        Private m_isLooping As Boolean

        ''' <summary>
        ''' Gets the number of frames in the animation.
        ''' </summary>
        Public ReadOnly Property FrameCount() As Integer
            Get
                Return Texture.Width / FrameWidth
            End Get
        End Property

        ''' <summary>
        ''' Gets the width of a frame in the animation.
        ''' </summary>
        Public ReadOnly Property FrameWidth() As Integer
            ' Assume square frames.
            Get
                Return Texture.Height
            End Get
        End Property

        ''' <summary>
        ''' Gets the height of a frame in the animation.
        ''' </summary>
        Public ReadOnly Property FrameHeight() As Integer
            Get
                Return Texture.Height
            End Get
        End Property

        ''' <summary>
        ''' Constructors a new animation.
        ''' </summary>        
        Public Sub New(ByVal texture As Texture2D, ByVal frameTime As Single, ByVal isLooping As Boolean)
            Me.m_texture = texture
            Me.m_frameTime = frameTime
            Me.m_isLooping = isLooping
        End Sub
    End Class
End Namespace
waldi_ is offline  
Reply


Similar Threads Similar Threads
Problem With A Code
12/09/2009 - CO2 Private Server - 4 Replies
Hey guys i been trying to figure out the Weekly Pk Event for all the classes But im not sure if i quite got it ._. heres what i got so far #region Pk Event if (DateTime.Now.DayOfWeek == DayOfWeek.Friday) { GC.MyChar.OpenWindow("Class pk war is about to begin! Will you join it?");
Mob appear code, problem with bot IQ
08/30/2009 - Kal Online - 12 Replies
Hello, I've got problem with my bot IQ. Sometimes he is trying to attack mobs on map that are not visible (used 2nd kal client to check it). Sometimes he dont see the nearest mob near him. Especially when aggresive mobs attack my bot. I've filtered the mob list and when X or Y are inproper like: Mob: ID 19351432 X 233 Y 256555 Z 0 HP 207 Mob: ID 1483628888 X 16805481 Y 260840 Z 0 HP 3 Mob: ID 19298786 X -66 Y 257724 Z 0 HP 243
Assembly code Problem
08/19/2009 - Dekaron - 3 Replies
Hi i have the assembly code for a hack and i want to find the proper adress for the hack but when im searching in CE the assembly scan returns nothing. Btw for the others hacks assembly scan returns something. Why this could be happening? thanks Edit:thats the code im trying to get, movzx eax,word ptr opps sorry didnt saw that questions not allowed.
problem beim code
11/09/2008 - Metin2 Private Server - 1 Replies
hi, ahb code problem: -> bin kein admin, kann nicht installieren. kann einer von euch den code holen? Link: http://img504.imageshack.us/img504/9671/neubitmap2 sl7.png Bitte.. 7 thanks bekommst dann.
Code-Problem
02/21/2008 - General Coding - 22 Replies
Hi leute ich hab ma ne frage, weis einer von euch wie ich in einer index-Datei an geben muss, das man was downloaden kann?? weil ich will ne index schreiben, das man sich verschiedene schachen von meinem FTP ziehen kann!! ^^ nur ich weis leider den Befahl net, das das dann funzt!! Bitte um hilfe!!



All times are GMT +1. The time now is 14:33.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.