Begining programming

Source code I have written openly published for your viewing pleasure.


Begining programming

Postby mac9416 » Sat Jan 12, 2008 7:51 pm

I have nearly NO programming experience (unless you consider QBasic to be valid programming experience :oops: ) but I would like to make my own 2D games. I could use some suggestions for language(s) that might work for me, and maybe a few good Wikis or books to check out.

Thanks ahead of time.
============================================
Spock: I fail to comprehend your indignation, sir. I have simply made the logical deduction that you are a liar.
============================================
Live long and prosper.
User avatar
mac9416
U.E. Graduate
U.E. Graduate
 
Posts: 61
Joined: Sat Dec 22, 2007 3:58 pm
Location: Memphis TN (just out of gunshot range)
Age: 24
Operating System: Ultimate Edition 3.1 64 BIT



Re: Begining programming

Postby TheeMahn » Mon Jan 14, 2008 10:02 am

mac9416 wrote:I have nearly NO programming experience (unless you consider QBasic to be valid programming experience :oops: ) but I would like to make my own 2D games. I could use some suggestions for language(s) that might work for me, and maybe a few good Wikis or books to check out.

Thanks ahead of time.



I would suggest C, it is an all around good language for doing anything, I will forewarn you it will be quite difficult to learn now that you know basic, I bought a book "learn C in 14 days", a total waste... Chapter 1 said if you know visual basic you may as well hang it up now, it will be tremendously difficult to learn as you will compare basic to C.

It did indeed take me a long time to learn C, ASM was the hardest language I have ever learned I suggest staying away from it it is faster then C, but make a mistake there and it will lock up your system losing your code since your last save at least that was the way it was back in the the Commodore 64 days, been a long time since I used it obviously, but still remember #C000 in hex = 49152 in decimal which is the address I did most of my programming.

There are many websites that teach programming in C can you say "Hello World" Google it ;)

Wish you the best of luck and look forward to seeing some of your work here.

Best regards,

TheeMahn
Home of Ultimate Edition. Got a question? Please review the F.A.Q. Browse the How to section.

Main O/S: Builder of O/S Guess.
Mainboard: ASUS Hero VI (AM4)
CPU: AMD 1700X water cooled (Deepcool Captain Genome Cooling tower)
Ram: 16 GB GSkill Trident RGB Series Dual Channel DDR4 3200
Video: MSI RX470 8GB Gaming card.
Hard Disks: MASSIVE on the network.(10 Gigabit, 48 port, multiple servers)
Monitors: 4K Samsung 28", HannsG HH281, Various others
750 Watt modular PSU (Rosswell)
1100 Watt Amp & 4 X 600 Watt speakers

Servers in the basement.
User avatar
TheeMahn
Site Admin
 
Posts: 4199
Joined: Fri Oct 12, 2007 10:02 am
Location: U.S.A.
Age: 47
Operating System: Ultimate Edition Developer



Re: Begining programming

Postby mac9416 » Mon Jan 14, 2008 5:48 pm

TheeMahn,

Thanks for the advice.
I have TRIED to read a C book, but it boggled my mind. :ugeek: :cry: I have read a little bit about Pygame and it looks like fun. However, I will try to break the ice and learn C. The only problem that I had when I read the book was that It didn't talk about how to display the "eye candy". I'll keep looking.
Thank you. You're Thee Mahn ;)

Yours truly,
Mac
============================================
Spock: I fail to comprehend your indignation, sir. I have simply made the logical deduction that you are a liar.
============================================
Live long and prosper.
User avatar
mac9416
U.E. Graduate
U.E. Graduate
 
Posts: 61
Joined: Sat Dec 22, 2007 3:58 pm
Location: Memphis TN (just out of gunshot range)
Age: 24
Operating System: Ultimate Edition 3.1 64 BIT



Re: Begining programming

Postby mac9416 » Sat Jan 26, 2008 7:35 pm

Well, I got a few Pygame Howtos and a simple bouncing ball animation:
Code: Select all
import sys, pygame
 pygame.init()

 size = width, height = 320, 240
 speed = [2, 2]
 black = 0, 0, 0

 screen = pygame.display.set_mode(size)

 ball = pygame.image.load("ball.bmp")
 ballrect = ball.get_rect()

 while 1:
     for event in pygame.event.get():
         if event.type == pygame.QUIT: sys.exit()

     ballrect = ballrect.move(speed)
     if ballrect.left < 0 or ballrect.right > width:
         speed[0] = -speed[0]
     if ballrect.top < 0 or ballrect.bottom > height:
         speed[1] = -speed[1]

     screen.fill(black)
     screen.blit(ball, ballrect)
     pygame.display.flip()


and turned it into this (very) primitive Pong game. It just shuts down when you miss the ball and sometimes the ball just flies right through the paddle. Other than that it's a great game! ;)

Code: Select all
import sys, pygame
pygame.init()

size = width, height = 1000, 800
speed = [5, 5]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

mouseposseccond = [0, 0]
mousemove = [0, 0]

ball = pygame.image.load("ball.png")
ballrect = ball.get_rect()
paddle = pygame.image.load("paddle.png")
paddlerect = paddle.get_rect()

paddlerect = paddlerect.move(0, height - 40) # Moves the paddle to just above the bottom of the screen.

while mouseposseccond < 1: # Finds the position of the cursor to mstart the game

    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

    mouseposseccond = pygame.mouse.get_pos()
   

while 1:

    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

    # The following lines start with the position of the cursor
    # at the beginning of the loop....
    mouseposfirst = pygame.mouse.get_pos()

    mousemove[0] = mouseposfirst[0] - mouseposseccond[0]
    mousemove[1] = mouseposfirst[1] - mouseposseccond[1]
    # ....And finishes with the difference between where the cursor was and
    # where it now is.

    paddlerect = paddlerect.move(mousemove[0], 0) # Moves the paddle on one axis(horizontal).
    ballrect = ballrect.move(speed)

    if ballrect.left < 0 or ballrect.right > width:
        speed[0] = -speed[0]
    if ballrect.top < 0:
        speed[1] = -speed[1]
    if ballrect.top > height:
        sys.exit()

    if paddlerect.top == ballrect.bottom and paddlerect.left < ballrect.right and paddlerect.right > ballrect.left: # IE "If the ball is in the middle of the paddle"
        speed[1] = -speed[1]

    # This next line is just in case the programming doesn't catch that
    # the ball has actually hit the paddle. (It has happened to me)
    if paddlerect.bottom == ballrect.bottom and paddlerect.left < ballrect.right and paddlerect.right > ballrect.left:
        speed[1] = -speed[1]

    mouseposseccond = mouseposfirst
   
    screen.fill(black)
    screen.blit(ball, ballrect)
    screen.blit(paddle, paddlerect)
    pygame.display.flip()


Not very good but fun to look at. I hope everyone has either a good time or a few laughs with it ;) . Just remember, I'm a noob. :geek:
============================================
Spock: I fail to comprehend your indignation, sir. I have simply made the logical deduction that you are a liar.
============================================
Live long and prosper.
User avatar
mac9416
U.E. Graduate
U.E. Graduate
 
Posts: 61
Joined: Sat Dec 22, 2007 3:58 pm
Location: Memphis TN (just out of gunshot range)
Age: 24
Operating System: Ultimate Edition 3.1 64 BIT



Re: Begining programming

Postby aperrigo » Sat Feb 02, 2008 1:12 am

I have a request...This week in my ASP.NET class I am working on debugging...but I had a terrible time with coding session-states that stored information into a public class ...and later when revisiting/refreshing/or posting back to that page reloading that same said information back into appropriate locations...ie. like a person's name within the name textbox.

My request is: besides the MSDN websites...where is some other sites. or sources of information that would give me better examples then my VB, C#, C++ , and ASP books.
Intel Quad Processor 9450 2.6 Ghz
Microsoft Windows Vista x64*(Service Pack 1, v.668)
Ultimate Ubuntu Edition 1.8 x64
XFX Nvidia n790i Ultra
1 * Nvidia PNY Geforce GX280 1 GHz 1GB
4GB DDR3 Corsair at 1333MHz
1 * Western Digital Velociraptor 300 GB SATA 3.0 Gbps Vista Drive
1 * Western Digital 320 GB SATA 3.0 Gbps*Linux Drive
2 * Western Digital Raptor 10000 RPM SATA 1.5 Gbps* Game Drive (RAID 0)
I like answers that aren't correct from politicians
User avatar
aperrigo
U.E. Graduate
U.E. Graduate
 
Posts: 73
Joined: Sun Jan 20, 2008 1:33 am
Location: Gallatin, TN 37066
Age: 36
Operating System: Ultimate Edition 3.2 64 BIT



Re: Begining programming

Postby mac9416 » Sat Feb 02, 2008 9:22 pm

aperrigo wrote:I have a request...This week in my ASP.NET class I am working on debugging...but I had a terrible time with coding session-states that stored information into a public class ...and later when revisiting/refreshing/or posting back to that page reloading that same said information back into appropriate locations...ie. like a person's name within the name textbox.

My request is: besides the MSDN websites...where is some other sites. or sources of information that would give me better examples then my VB, C#, C++ , and ASP books.


I wish I could help ,aperrigo, but it looks like you know more about programming than I am likely to for a long time. Maybe TheeMahn will stop by here and help you out. :)

ps: I see your from Tennessee. Glad I'm not alone. :D ;)
============================================
Spock: I fail to comprehend your indignation, sir. I have simply made the logical deduction that you are a liar.
============================================
Live long and prosper.
User avatar
mac9416
U.E. Graduate
U.E. Graduate
 
Posts: 61
Joined: Sat Dec 22, 2007 3:58 pm
Location: Memphis TN (just out of gunshot range)
Age: 24
Operating System: Ultimate Edition 3.1 64 BIT



Re: Begining programming

Postby cowboy » Sat Feb 02, 2008 10:08 pm

Hello here are a few starts, google is a warehouse full of info.. :) here,, http://www.programmingtutorials.com/javascript.aspx and another http://www.hitmill.com/programming/cpp/cpp.html and one I can read good..large fonts.. http://www.stat.rice.edu/~helpdesk/howto/cshell.html this will keep you busy, and good luck on your endeavours. ;)
"Back up your Data"
"May I never lose the view of a nubie"
"Give a man a fish, he will eat for a day, teach a man how to fish , he will eat a lifetime"
Asus P8Z68-V PRO/GEN3
i5 2500k
3x4G-Skill Ripjaws
MSI GTX 560Ti Hawk..
Seagate 1TB Barracuda
NZXT 850w PS
CM Storm Sniper Case
Evga Superclock CPU Cooler
Mushkin SSD coming soon
http://acowboydave.blogspot.com/
User avatar
cowboy
U.E. God
U.E. God
 
Posts: 2625
Joined: Mon Oct 15, 2007 2:38 pm
Location: Scottsdale Az
Age: 66
Operating System: Ultimate Edition 3.2 64 BIT



Re: Begining programming

Postby mac9416 » Sun Feb 10, 2008 7:09 pm

I use a simple clock desklet that looks easy to mod maybe. It looks like it's in Python, which I know a very little bit about. Any tips? Wish me luck. :lol:
============================================
Spock: I fail to comprehend your indignation, sir. I have simply made the logical deduction that you are a liar.
============================================
Live long and prosper.
User avatar
mac9416
U.E. Graduate
U.E. Graduate
 
Posts: 61
Joined: Sat Dec 22, 2007 3:58 pm
Location: Memphis TN (just out of gunshot range)
Age: 24
Operating System: Ultimate Edition 3.1 64 BIT



Re: Begining programming

Postby mac9416 » Sat Feb 16, 2008 6:42 pm

Hello everybody,
I think I may have broke Google's server :lol: . Yet, I still can't seem to find out how to program 2D games with c/c++ though. I am pretty sure that Freeciv is done in c++. Why can't I make a game that has "eye candy" too, instead of the boring ole' "hello world" type program. I'm confused. A little help.
Thanks for hangin' in there with me.
============================================
Spock: I fail to comprehend your indignation, sir. I have simply made the logical deduction that you are a liar.
============================================
Live long and prosper.
User avatar
mac9416
U.E. Graduate
U.E. Graduate
 
Posts: 61
Joined: Sat Dec 22, 2007 3:58 pm
Location: Memphis TN (just out of gunshot range)
Age: 24
Operating System: Ultimate Edition 3.1 64 BIT


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest