Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › C# coding help/XNA game 4.0
New Posts  All Forums:Forum Nav:

C# coding help/XNA game 4.0

post #1 of 22
Thread Starter 
Hi all,

I am trying to make a simple game using Visual Studion 2010, with an XNA 4.0 game project. What i am having trouble doing is once my avatar moves close to the edge of the screen ( top, bottom, left and right), i would like the background to change (so that its like a new "location" and perhaps have the avatar's X/Y coordinates change as well when it crosses/enters into the new location. I have a base background picture ( i have using simple 2D pics) so how would i go about doing this? Any help is greatly appreciated!!

Thanks!!!
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
post #2 of 22
Let's say your map is organized into 9 sections, 3x3. Your character starts in the [0][0] tile (top-left). He starts walking right towards the [0][1] tile. Once he gets the edge of the [0][0] tile, you can have the background change to the [0][1] tile and update your character's x-coordinate to the left-edge of the screen. That is one way of doing it. Does it make sense?
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
post #3 of 22
Thread Starter 
I somewhat understand what you are saying, but if i give the user controls on the keyboard to control the movement of the avatar, making it completely user based (and random) then how could i control which background arises. What codes would that involve?
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
post #4 of 22
If user approaches right edge of the screen,
Then load tile [current][current+1] and set his x-coordinate equal to the left-end of the screen.

If user approaches left edge of the screen,
Then load tile [current][current-1] and set his x-coordinate equal to the right-end of the screen.

If user approaches bottom edge of the screen,
Then load tile [current+1][current] and set his x-coordinate equal to the top-end of the screen.

If user approaches top edge of the screen,
Then load tile [current-1][current] and set his x-coordinate equal to the bottom-end of the screen.

etc. etc. Try doing that.
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
post #5 of 22
Thread Starter 
thanks for the help, btw im still new to coding. So those codes are referencing c# correct?
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
post #6 of 22
Quote:
Originally Posted by Wight Faux View Post
thanks for the help, btw im still new to coding. So those codes are referencing c# correct?
They arent referencing any specific languages. If youre new to coding, game design isnt the best place to start. Its like jumping in at the deep end of the pool without knowing how to swim
    
CPUMotherboardGraphicsGraphics
FX-8350 Asus Crosshair V MSI GTX460 Hawk 1gb MSI GTX460 Hawk 1gb 
RAMHard DriveHard DriveHard Drive
Kingston HyperX 8gb (2x4gb) Crucial M4 64GB Samsung F3 1TB Western Digital 320GB 
CoolingOSMonitorMonitor
Custom WC Windows 7 Ultimate X64 Dell E2311H Dell E2311H 
MonitorKeyboardPowerCase
LH 23EN43 Ducky Year of the Dragon 2012 SilverStone Strider 1000W-P Corsair 800D 
Audio
Asus Xonar Essence STX 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
FX-8350 Asus Crosshair V MSI GTX460 Hawk 1gb MSI GTX460 Hawk 1gb 
RAMHard DriveHard DriveHard Drive
Kingston HyperX 8gb (2x4gb) Crucial M4 64GB Samsung F3 1TB Western Digital 320GB 
CoolingOSMonitorMonitor
Custom WC Windows 7 Ultimate X64 Dell E2311H Dell E2311H 
MonitorKeyboardPowerCase
LH 23EN43 Ducky Year of the Dragon 2012 SilverStone Strider 1000W-P Corsair 800D 
Audio
Asus Xonar Essence STX 
  hide details  
Reply
post #7 of 22
Quote:
Originally Posted by Wight Faux View Post
thanks for the help, btw im still new to coding. So those codes are referencing c# correct?
Noooope. That's just pseudo-code, if you can even call it that.

Quote:
Originally Posted by FiX View Post
They arent referencing any specific languages. If youre new to coding, game design isnt the best place to start. Its like jumping in at the deep end of the pool without knowing how to swim
Absolutely agreed. @OP: I know it's tempting to just jump straight into game development, but trust me, you're simply going to end up getting frustrated and floundering. Pick up a book on basic C# programming so you can learn basic programming concepts as well as relevant C# syntax. Trust me, the reward is worth it in the end. Rather than struggling with these game tutorials, you'll be breezing through them and be onto bigger and better things.
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
post #8 of 22
If you wanna learn how to do this sort of stuff then visit our site at www.howto-media.com we do all sorts of IT tutorials
post #9 of 22
Thread Starter 
gotcha, well thanks for your help! im going to try and figure this out.
And ya im learning the hard way that jumping into game design is tough. Im in a c# game-based programming class, i was thinking it would be easier than c++, java or regular c#... i was definitely wrong.
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
BloodRage i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
core i7 920 D0 @ 3.02 Foxconn Bloodrage GTi EVGA GTX 560 ti DS SC G. Skill Ripjaws 8GB 1600MHz 
Hard DriveOptical DriveMonitorKeyboard
2 640GB WD Caviar Black Asus DRW-24B1ST 24x DVD RW 23" Acer H233H 1080p & 22" Asus ML228h 1080p LED Razor Lycosa Mirror Edition 
PowerCaseMouse
Antec TruePower Quattro 1000W Antec 1200 Razer Naga 
  hide details  
Reply
post #10 of 22
Quote:
Originally Posted by Wight Faux View Post
gotcha, well thanks for your help! im going to try and figure this out.
And ya im learning the hard way that jumping into game design is tough. Im in a c# game-based programming class, i was thinking it would be easier than c++, java or regular c#... i was definitely wrong.
Definitely. Game programming can often involve some very complex programming concepts and at first-glance, everything can just fly over your head. Writing little console programs in those "regular" classes may not be as exciting as creating a game, but they go a long way in giving you a solid foundation onto which you can build your skills towards game programming.

Oh, and game programming also involves a lot of math, depending on what you're doing, so be aware of that.
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
myTX Prodigy
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-3570 ASUS P8H77-I XFX Radeon HD 7870 Double D GSKILL 8GB DDR3-1600 
Hard DriveHard DriveHard DriveHard Drive
Samsung SSD 840 250GB Crucial m4 128GB Seagate Barracuda 500GB Western Digital Black 1TB 
Optical DriveOSMonitorKeyboard
ASUS CD/DVD RW 24X Windows 8 Pro x64 ASUS VE247 24" Microsoft Sidewinder X4 
PowerCaseMouseMouse Pad
Corsair TX550M Bitfenix Prodigy Steelseries Kinzu Gigabyte Ghost 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › C# coding help/XNA game 4.0