Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / gun movement

Author
Message
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 26th Mar 2009 05:44
what is the best way to get a gun to move back and forth as you walk? im not sure how to do this.
SuperSnake
15
Years of Service
User Offline
Joined: 19th Mar 2009
Location:
Posted: 28th Mar 2009 01:22
This is actually really simple. First, you might want to get a good idea of how it works. Open up the Samples C++ project that came the program and click on Dark Dungeon. Look through and you'll see how it uses variables to move the gun up and down. If you still don't understand, then I'll help you:

1. Make 2 Variables called gunWaggle and gunWaggle2 at the start of your program:


2. In you movement section, where you have the commands for the up key input, put this:


3. Then put this code near the bottom:


You might want to tweak some of those values to get a more desirable result. If you have any more questions just ask!
Slimey
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 1st Apr 2009 04:51
When I use your technique SuperSnake, my gun seems to just keep moving down. Any idea what I did wrong?
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 11th Apr 2009 07:42 Edited at: 11th Apr 2009 07:43
yeah that code isnt working for me either.

my code looks like this



its the same basic thing but the object just moves off the screen and keeps going, even before i press the up key.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 11th Apr 2009 17:18
I just like animating my gun to move, saves code space
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 12th Apr 2009 08:12
well i am using a gun that someone already made. i dont really want to go into an animation program and set up some animation for it. i just cant get this code to work... :/

Login to post a reply

Server time is: 2024-11-25 14:46:07
Your offset time is: 2024-11-25 14:46:07