Topic:   My iPhone Game Tutorials for Beginners   (Read 423360 times)


0 Members and 2 Guests are viewing this topic.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #195 on: May 01, 2011, 08:54:09 PM »
in the 'other languages and tools' section of the forums I found the post 'Cocca (objective-C)' I looked through it and found the link you put there for 'Become An Xcoder' and it was extremely helpful.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #196 on: May 01, 2011, 09:07:23 PM »
Yeah it is. :) That's the one that really pushed me into serious Obj-C programming.

Literally read the whole thing.
« Last Edit: May 01, 2011, 09:07:35 PM by Gandolf »

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #197 on: May 01, 2011, 09:16:15 PM »
Code: [Select]
int x = 5, y = 12, ratio; ratio =y / x;
it said that ratio would be 2 instead of 2.4 does the compiler estimate, or does it just plain drop the factions? Also can a block of code like this exist? Also I thought variables had to be predefined in .h files and executed in .m files?
« Last Edit: May 01, 2011, 09:18:16 PM by KurtManion »
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #198 on: May 02, 2011, 09:07:55 AM »
Integers are whole numbers. If you set an integer to a fraction of a number, it rounds to the nearest whole number.
Yes you can have clumped stuff like that.

Variables that you want to use anywhere in the .m file must be declared in the .h. Though you can declare local variables in the .m file. They just won't be global.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #199 on: May 02, 2011, 02:48:26 PM »
OOHHH that makes total sense. Thanks. What do you do to get a random number picker. I'm trying to make a dice roller to get acquainted with code Object-C from 'scratch'
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #200 on: May 02, 2011, 02:56:54 PM »
Loading
Code: [Select]
/* initialize random seed: */
 Â srand ( time(NULL) );
Anywhere Else
Code: [Select]
//Get a random number, can be 0,1,2,3 or 4
int randomNumber = rand()%5;
« Last Edit: May 02, 2011, 02:57:14 PM by Gandolf »

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #201 on: May 02, 2011, 03:03:56 PM »
what does the line
Code: [Select]
 srand ( time(NULL) ) ;
what does that do? The individual parts. The way I've learn things is taking them apart from the inside. Is time(NULL) a main() function. Also what happens to the variables inside the parenthesis, ie. NULL
And how do you program an IF THEN statement.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #202 on: May 02, 2011, 03:13:17 PM »
Also what coding languages can you use in Object-C and howdy you incorporate them into your game. And how do you see the internal structures of main() function        thingys
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #203 on: May 02, 2011, 03:27:49 PM »
also what the heck does void mean?
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #204 on: May 02, 2011, 03:58:13 PM »
Quote
what does that do? The individual parts. The way I've learn things is taking them apart from the inside. Is time(NULL) a main() function. Also what happens to the variables inside the parenthesis, ie. NULL  
time() is a C function. time(null) gets the number of seconds since Jan 1 1970.
NULL means nothing. So you give the function nothing.

Quote
And how do you program an IF THEN statement.
Code: [Select]
int test = (rand()%2)+1;
if (test == 1) {
 Â   //Do Stuff
} else if (test == 2) {
 Â   //Do Stuff
}

Quote
Also what coding languages can you use in Object-C and howdy you incorporate them into your game. And how do you see the internal structures of main() function   thingys
You can use C and C++ with Objective-C. To find functions, either Google or search the Xcode documentation.

Quote
also what the heck does void mean?
Void means that the function returns nothing.
Code: [Select]
- (void)stuff {
 Â  //stuff
}
- (void)awakeFromNib {
 Â   [self stuff];
}
If you want the function to return something you can do:
Code: [Select]
- (int)stuff {
 Â  //stuff
 Â  return 5;
}
- (void)awakeFromNib {
 Â   int testNum = [self stuff];
}
« Last Edit: May 02, 2011, 03:58:30 PM by Gandolf »

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #205 on: May 02, 2011, 04:33:18 PM »
I get it, cool. While reading how to become an Xcoder (I'm on chapter 8 ) It sounds like you have to keep gaining different functions to create programs. Where would be the best place to find a list of all the really useful & most commonly used functions for Beginner, intermediate, and Experience Xcoders.
« Last Edit: May 02, 2011, 04:33:40 PM by KurtManion »
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #206 on: May 02, 2011, 04:39:21 PM »
Also what the heck is a argument. The document keeps referring to it, and I'm not quite sure what it is.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: My iPhone Game Tutorials for Beginners
« Reply #207 on: May 02, 2011, 05:07:20 PM »
Quote
I get it, cool. While reading how to become an Xcoder (I'm on chapter 8 ) It sounds like you have to keep gaining different functions to create programs. Where would be the best place to find a list of all the really useful & most commonly used functions for Beginner, intermediate, and Experience Xcoders.
never mind I just read the part on documentation, and found most of what I was looking for.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #208 on: May 02, 2011, 05:23:52 PM »
Quote
Also what the heck is a argument. The document keeps referring to it, and I'm not quite sure what it is.
The argument is the variable you're putting in the function.

Code: [Select]
int myVar = 5;
[self doStuff: myVar];
myVar is the argument cause you're putting it in a function so the function can use it.

breshi


  • GMG Newbie

  • *


  • Posts: 31

  • Carpe Diem
Re: My iPhone Game Tutorials for Beginners
« Reply #209 on: May 02, 2011, 08:47:10 PM »
 ???
I also have written what I think is a great game using your template. I was all set to release it but then the new operating system came out and slowed it right down so it is now unplayable.
I've reduce the loop time but still it is way too slow.
Any suggestions?