Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Hotkeys In C#?


  • Please log in to reply
9 replies to this topic

#1 Wolfy87

Wolfy87

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:07:52 PM

Posted 22 August 2008 - 10:45 AM

i need to assign w, a, s, d, to move a image box round the screen by pressing i.e... W will add 6 to the Y axsis. Can anyone help?

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:52 PM

Posted 22 August 2008 - 10:59 AM

Sure. What research have you done so far, and what does your code look like. Part of learning how to program is being able to use your favorite search engine in order to find what you need. Try that first.

#3 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:07:52 PM

Posted 22 August 2008 - 11:10 AM

Well thats just it, every were i look the awnsers are proboly stairing me in the face but i just cant understand it so im thinking of trying something like this but it dosent seem to work but here it is anyway...

private void W_Click(object sender, EventArgs e)
{
//Moves Char up the Map.
pictureBox3.Location = (187, 183+1);
}

I am using a label named &W as the button...

Can i use this sort of code for i want it to be If the char is in grass (whitch will be placed around the map) then there will be a random event where it chosses a random number between for example 1 and 6 and if its a 1 or 4 nothing happens but if its a 5 or 6 you have to fight something. i have that planned but how will i tell it to activate this process. would it be something like this...

If pictureBox3.Location = (201, 178) then....i have the bit after that all worked out but how do i use the locations??

i have alot more code and i will have to do the same for asd but this is how i started then i came to a grinding halt, it worked on my scoring system on my shooting game though...

Also how do i make a form pop up due to a click of a button in C# because it worked like this in VB and wont work in here...
Form2.Show();
Thats all i got :s

Edited by Wolfy87, 22 August 2008 - 11:22 AM.


#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:52 PM

Posted 22 August 2008 - 11:26 AM

I think you should look a this:
http://creators.xna.com/en-US/education/gettingstarted

#5 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:07:52 PM

Posted 22 August 2008 - 11:32 AM

But i am using C# not xna? i dont get it, i will gladly watch it but are they a compleatly different laguage?

Ah! i see it uses C# but this is 2005 i have 2008 will that be a problem?

Edited by Wolfy87, 22 August 2008 - 11:35 AM.


#6 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:07:52 PM

Posted 22 August 2008 - 11:44 AM

I am downloading XNA 2.0 now and i spose its a sort of mod for C# or an add on and dose it explain hot keys in the videos then?... Thanks for all you help, Ollie

#7 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:52 PM

Posted 22 August 2008 - 11:55 AM

It is a development environment specifically for creating games using C#. THe video tutorial I linked you to should answer questions about event listeners, as well as a few other things. Languages do not have 'mods' or 'add-ons'; they have libraries. Some of the stuff is hidden in the background, but if you have a game that you are trying to develop, then do it in the game studio, since it will handle a lot of the details for you. There is also an excellent support forum where you can find all sorts of code, and help.

#8 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:07:52 PM

Posted 22 August 2008 - 11:57 AM

ok then thanks and if i learn code from this 2005 can i use it in my own game witch is in 2008?

Edited by Wolfy87, 22 August 2008 - 12:01 PM.


#9 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:52 PM

Posted 22 August 2008 - 12:04 PM

C# is a programming language. The environment that you use to create a program using C# in no way alters the programming language. IF you learn the code in XNA, the code is exactly the same no matter where you use it.

#10 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:07:52 PM

Posted 22 August 2008 - 12:07 PM

Thats great, Thankyou all i have to do now is wait for C# 2005 and SP1 to install :thumbsup: .




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users