Results 1 to 4 of 4
  1. #1
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed

    Help with Sprites

    I loaded two sprites:

    MainMenu and Battle

    I then display it like this:
    Code:
    void MainMenu(void)
    {
        mainmenu->Draw(mainmenusprite, NULL, &center, &position, D3DCOLOR_XRGB(255, 255, 255));
    	if(GetAsyncKeyState(VK_ESCAPE))
    	{
    		mainmenu->Draw(battlesprite, NULL, &center, &position, D3DCOLOR_XRGB(255, 255, 255));	
    	}
    	if(GetAsyncKeyState(VK_INSERT))
    	{
    		mainmenu->Draw(mainmenusprite, NULL, &center, &position, D3DCOLOR_XRGB(255, 255, 255));	
    	}
    }
    When I press those buttons though, the sprite only stays there when I hold the button. How do I make it stay there permanently even if I let go of the key?
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


  2. #2
    mmbob's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    ja
    Posts
    653
    Reputation
    70
    Thanks
    1,157
    My Mood
    Bitchy
    To answer your question: You would have a boolean (or have game states) that would store the "show this sprite" value. Every time the key is pressed you would flip the value. When the value is true, display the sprites.

    A recommendation: Don't use GetAsyncKeyState in any actual applications. It's very unreliable and "polling" is not recommended by Microsoft. Handle WM_KEYDOWN and WM_KEYUP to do the dirty work of input.

  3. The Following 2 Users Say Thank You to mmbob For This Useful Post:

    aanthonyz (04-24-2011),[MPGH]master131 (04-24-2011)

  4. #3
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,858
    Reputation
    3438
    Thanks
    101,668
    My Mood
    Breezy
    Quote Originally Posted by mmbob View Post
    To answer your question: You would have a boolean (or have game states) that would store the "show this sprite" value. Every time the key is pressed you would flip the value. When the value is true, display the sprites.

    A recommendation: Don't use GetAsyncKeyState in any actual applications. It's very unreliable and "polling" is not recommended by Microsoft. Handle WM_KEYDOWN and WM_KEYUP to do the dirty work of input.
    This is true, if I used GAKS and the game wasn't the active window and I pressed left or right arrow the sprite would change anyway.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.7.3
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  5. #4
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    Thanks I fixed it now.
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon: