Welcome to Phrogram Sign in | Join | Help
in Search


Rotating sprites

Last post 08-06-2008, 9:59 AM by TomDad. 11 replies.
Sort Posts: Previous Next
  •  07-31-2008, 8:20 PM 6988

    Rotating sprites

    Hey guys, I have a bit of a problem with rotating my sprite.

    Heres my code:

    Program Game

        
        Define Ship As Sprite
        Define background As Sprite    
        Define LocationX As Integer = 290
        Define LocationY As Integer = 225
        

        
        Method Main()
            background.Load ( "background.gif" )
            
            background.Show()
            
            Ship.load ( "ship.gif")
            
            Ship.Show()
            
            ship.MoveTo(LocationX, LocationY)
            
            While iskeydown ("Q") = False
                
                Delay (10)
            
                If iskeydown("Right") Then
                    LocationX = LocationX +3
                End If
            
                If iskeydown ("left") Then
                    LocationX = LocationX -3
                End If
            
                If iskeydown ("up") Then
                    locationY = LocationY -2
                End If
            
                If iskeydown ("down") Then
                    LocationY = LocationY +2
                End If
            
                Ship.MoveTo(LocationX, LocationY)
            End While

     

    Now it works and everything but my ship is facing in the wrong direction.

    I have tryed to use these methods "ship.flipvertical() and Horizontal but it still doesnt seem to face the right way.

    Could anyone help me with this problem.

     

  •  08-01-2008, 3:29 PM 6997 in reply to 6988

    Re: Rotating sprites

    I use

    Sprite.Rotation = (whatever you want it to be)

    0 or 360 = up/normal,

    90 = right

    180 = down

    270 or -90 = left

     

  •  08-01-2008, 6:15 PM 6998 in reply to 6997

    Re: Rotating sprites

    Tried doing what you said and it says "Rotation is a property but is being used like a method".
  •  08-02-2008, 4:40 AM 7001 in reply to 6997

    Re: Rotating sprites

    Try

    Sprite.Rotation( whatever you want it to be ).

    To be shure that it works with degrees ( 360 for a full circle ) at start of your MainLoop write:

    AngleMeasureUnit = Degrees

    Michael

  •  08-02-2008, 5:41 PM 7004 in reply to 7001

    Re: Rotating sprites

    A better way for me to say it would be:

    Sprite.Rotation = rotation

    Where rotation is a value that you specify, for example

    Sprite.Rotation = 90 

    The "(" & ")" symbols are not used in the IDE. 

  •  08-03-2008, 11:06 PM 7011 in reply to 7004

    Re: Rotating sprites

    still not working....
  •  08-04-2008, 6:27 AM 7012 in reply to 7011

    Re: Rotating sprites

    If the problem is that the sprite is rotated the wrong way, the problem might be that the computer thinks the "front" of the sprite is really the side. Then when it tries to rotate it, the side the computer thinks is the front gets rotated 90 degrees and it is facing differently then you pictured because you thought of a different side of the sprite as the "front".

    I realize this sounds confusing but I hope it helps.


    I wonder... do phrogs eat phlies????
  •  08-04-2008, 8:37 AM 7013 in reply to 7012

    Re: Rotating sprites

    You need to describe what you are getting and what you are expecting. "It faces the wrong way" tells us little to help you specifically.

    If you use the flip commands they will reverse the image in a mirror like manner.

    If you use the rotate commands they will spin the sprite like an asteroids ship

    Depending on which you want and what you choose you might not get the right result. 

     


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
  •  08-04-2008, 3:58 PM 7015 in reply to 7013

    Re: Rotating sprites

    Im trying to use the rotate command but its just not working at all, phrogram doesn't recognize it.
  •  08-04-2008, 7:54 PM 7016 in reply to 7015

    Re: Rotating sprites

    Its a property called Rotation not a method called Rotate  

    Sprite.Rotation = value;

     


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
  •  08-05-2008, 10:03 AM 7017 in reply to 7016

    Re: Rotating sprites

    Sorry,

    ZMan is right. There is no Method called Sprite.Rotation( Angle ). Never answer again without testing what I say.

    Michael

  •  08-06-2008, 9:59 AM 7019 in reply to 7015

    Re: Rotating sprites

    You might want to put your updated code on here, even if it does error...

    We can see where you are not quite getting it right 100%...have a look also at the Phrogram example programs to see if you can find anything in there that demos what your trying to do...suggest that one first...


    TomDad. Tom is my son...and I'm his Dad. So we are TomDad Software.
View as RSS news feed in XML