Tuesday, May 28, 2013

New program out!

Hey there, what's up? I just made a new program and I thought it would be a good idea to blog about it! It's called "ProCoder Encoder". What it does, is that it allows you to communicate with others using messages encoded with a key that only you and the people you are communicating with know. It is very simple and easy to use, and also it is free! If you are interested, you can download it here. It only works on Windows. Make sure to read the "README" file first... I'm also now hosting any updates on the project on a different tab on this blog! Have a nice day!

P.S.: If running the program gives you errors, try deleting it and downloading it again.

Sunday, May 26, 2013

Urgh, finals!

Hey! I know I've been inactive for quite some time, and I want to apologize for that. The thing is, I'm going through finals currently, and it's kinda difficult to find the time to work on the blog, on my channel or on my game(s). But do not worry! Soon I will be back with lots of new stuff, like recordings, stuff about Python and more. Stay tuned!

Monday, May 13, 2013

Return Of The Dead - RotD Update #1

Heyyyy!!! How's it going? So, quite some time ago, I started developing an FPS game in Flash, and it...hasn't made much progress. And that's because its creation was poorly timed with my everyday schedule. But let me tell you the whole story.

The whole idea to make this game came from a "test project" I had done in Flash, which was finished around November of 2012 from what I can recall. I wanted to make an FPS, but I had tried again back in 2011 and failed miserably because of the lack of knowledge (especially in programming). So, having tried many other programming languages, around late December of 2012 I thought of building upon this "fps test" file, and that was the birth of "Return of the Dead". I decided to make a game with zombies because that made the game production a lot easier in many ways, and that decision was quite wise, if you consider the people working on the project (it's only me, lol).

Unfortunately, I stopped working on the game around January of 2013, because my vacation ended, and with the school work and all being at least two times harder than last year (that's quite normal actually lol) I made my last additions to the game and then stopped completely working on it.

So, with my easter vacation the last two or three weeks, I had some time to add stuff. The only thing that gets in the middle now are my finals. Theoretically, I have the whole summer to work on the game. I say theoretically, because my finals end in 14th of June, and three weeks of July will be lost because of school summer classes which, unfortunately, are mandatory and of great importance for next year. The other thing is my band; we will possibly be working on our own songs. Finally, there is my channel, to which I came back actually in December 2012, and I don't want to leave it again for a long time.

With these being said, let me give you an update: The basics, meaning the gun, the HUD, the controls and everything, are ready. The menu is also almost ready, I just need to finish a couple of things, which are minor additions and stuff like that. The part of the game I haven't worked on contains picking up items, which I have not tried before and therefore I'm not sure if it will work the way I have in mind to make it, and this is mostly about programming. The last thing I have to do is make sure that the navigation system works, but I think this will be very easy, since I have done it in the past and I know it works.

So, thanks for reading! I also keep an update log, which I'm currently thinking about releasing, but for now, here's the logo of the game and a picture of the main menu:





Wednesday, May 8, 2013

How To Create A Class In Objective C (Xcode)

How To Create A Class In Objective C (Xcode)



Note 1: Every bit of code that is red means that it's the new code that's been added since last time.

Note 2: Everything mentioned here will only work in a Command Line Tool - Foundation project type.


So, let's begin by importing the Foundation file. This is just a bunch of code required for any Objective C program to run, so instead of writing it down each time we can just load the file that contains it:

#import <Foundation/Foundation.h>

Then, it's time to make the interface!

At first, let's name the class and write the variables:

#import <Foundation/Foundation.h>

@interface Person: NSObject{ int age; int weight; }

As you can see, we're making a class called "Person", and the only variables that we need are the person's age and weight.


Now let's go ahead and make the methods (aka what a "Person" can do, like "brush your teeth" or "eat" etc. - we'll keep it real simple though):

#import <Foundation/Foundation.h>

@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print; -(void) setAge: (int) a; -(void) setWeight: (int) w; @end

Since the interface is done, we can go ahead and make the implementation!

Firstly, we need to write the "print" method, which just takes the values of the "age" and "weight" variables and prints them on the screen:

#import <Foundation/Foundation.h>

@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print;
-(void) setAge: (int) a;
-(void) setWeight: (int) w;
@end

@implementation Person -(void) print{ NSLog(@"I am %i and weigh %i pounds", age, weight); }

Next, we need to do the same for the setAge and setWeight methods:

#import <Foundation/Foundation.h>

@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print;
-(void) setAge: (int) a;
-(void) setWeight: (int) w;
@end

@implementation Person
-(void) print{
 NSLog(@"I am %i and weigh %i pounds", age, weight);
}
-(void) setAge: (int) a{ age=a; } -(void) setWeight: (int) w{ weight=w; } @end

What they do, is that they take what's into the temporary variables ("a" and "w") and store it into the main variables ("age", "weight").


Now, we finally start making the actual objects!

First, let's make the main method:

#import <Foundation/Foundation.h>

// interface
@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print;
-(void) setAge: (int) a;
-(void) setWeight: (int) w;
@end

// implementation
@implementation Person
-(void) print{
 NSLog(@"I am %i and weigh %i pounds", age, weight);
}
-(void) setAge: (int) a{
 age=a;
}
-(void) setWeight: (int) w{
 weight=w;
}
@end

int main(int argc, char *agrV[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init]; }

Now, the object code:

#import <Foundation/Foundation.h>

// interface
@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print;
-(void) setAge: (int) a;
-(void) setWeight: (int) w;
@end

// implementation
@implementation Person
-(void) print{
 NSLog(@"I am %i and weigh %i pounds", age, weight);
}
-(void) setAge: (int) a{
 age=a;
}
-(void) setWeight: (int) w{
 weight=w;
}
@end

// main program
int main(int argc, char *agrV[]){
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
 
Person *nicolas; nicolas = [Person alloc]; nicolas = [nicolas init]; [nicolas setAge: 25]; [nicolas setWeight: 350]; [nicolas print]; [nicolas release]; [pool drain]; return 0;
}

So what we did here is: First, we declared the object. Then, we allocated (aka borrowed) some memory from the computer,and then we initialized it. Next, we used the "setAge" and the "setWeight" methods to get values for our original variables, and then we used the "print" method to, well, print the values, and then we released any memory that was held by our object. Last but not least, we drained our pool of memory and returned 0, which means that our program ended perfectly.

Now let's go ahead and add another object, but using a slightly different technique this time (which I highly suggest you should use):

#import <Foundation/Foundation.h>

// interface
@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print;
-(void) setAge: (int) a;
-(void) setWeight: (int) w;
@end

// implementation
@implementation Person
-(void) print{
 NSLog(@"I am %i and weigh %i pounds", age, weight);
}
-(void) setAge: (int) a{
 age=a;
}
-(void) setWeight: (int) w{
 weight=w;
}
@end

// main program
int main(int argc, char *agrV[]){
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
 Person *nicolas;
 
Person *james = [[Person alloc]init];
nicolas = [Person alloc]; nicolas = [nicolas init]; [nicolas setAge: 25]; [nicolas setWeight: 350]; [nicolas print]; [nicolas release];
[james setAge: 57]; [james setWeight: 310]; [james print]; [james release];
[pool drain]; return 0; }

So, now we want to add two more "getter methods". They are simply going to return the "age" and "weight" variables. This, though, allows us to access these vars, which makes it easier to print stuff out. Let's see:

#import <Foundation/Foundation.h>

// interface
@interface Person: NSObject{
 int age;
 int weight;
}
-(void) print;
-(void) setAge: (int) a;
-(void) setWeight: (int) w;
-(int) age;
-(int) weight;
@end

// implementation
@implementation Person
-(void) print{
 NSLog(@"I am %i and weigh %i pounds", age, weight);
}
-(void) setAge: (int) a{
 age=a;
}
-(void) setWeight: (int) w{
 weight=w;
}
-(int) age{
 return age;
}
-(int) weight{
 return weight;
}
@end

// main program
int main(int argc, char *agrV[]){
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
 
Person *james = [[Person alloc]init]; [james setAge: 57]; [james setWeight: 310]; NSLog(@"James is %i years old and weighs %i pounds", [james age], [james weight]);
[pool drain]; return 0; }

And that's how to create a Class!

Saturday, May 4, 2013

Python: Fahrenheit - Celsius Converter Tutorial

Python: Fahrenheit - Celsius Converter Tutorial


Introduction

Hello everybody, this is jimkokko5 on another tutorial. This time, we're talking about how to make a Fahrenheit - Celsius Converter in Python. I was, let's say, inspired to do this by the guys who teach me Interactive Python over at Coursera.org. It involves little knowledge of Python; it's real easy to make. Let's get started!


Getting Started

The first thing we need to do is to find the formulas needed to convert degrees in Fahrenheit to degrees in Celsius and vice versa. The next thing we need to do is to declare some global variables; we will need them later on.

# c = 5 / 9 * (f-32)
# f = 9 / 5 * c + 32

# define global variables
x = 0
y = 0

Making The Initialization Function

Next, what we need to do is set up our initialization function. This function simply displays text, and we need it to run immediately when the program starts.

# initialization function
def init():
    print "==========================================="
    print "Celsius - Fahrenheit Converter, v1.0"
    print "~Made by jimkokko5~"
    print "==========================================="
    print ""

Defining The Event Handlers

What we need to do now is to define our event handlers. These will run when the user enters a value, for example degrees in Celsius to be converted to degrees in Fahrenheit. The first one converts degrees Fahrenheit to degrees in Celsius, and the second one does the opposite.

# define event handlers
def f2c(f):
    f = float(f)
    c = 5 / 9  * (f-32)
    print f, "degrees Fahrenheit is", c, "degrees Celsius"
    print ""
 
def c2f(c):
    c = float(c)
    f = 9 / 5  * c + 32
    print c, "degrees Celsius is", f, "degrees Fahrenheit"
    print ""

As you can see, we take the string the user has entered, we convert it into a float (something close enough to a rational number) and we use the formulas we found earlier to convert it to the opposite value (if it's Celsius convert it to Fahrenheit and vice versa). Finally, we print the results.


Registering The Event Handlers

Last but not least, we need to register our event handlers, aka getting everything to run. This is real easy to do; we will also use our "x" and "y" global variables to hold the input.

# register event handlers
init()

x = input("Convert Fahrenheit to Celsius: ")
y = input("Convert Celsius to Fahrenheit: ")

f2c(x)
c2f(y)

And that's it. Our program is now ready to run!


Full Code

# c = 5 / 9 * (f-32)
# f = 9 / 5 * c + 32

# define global variables
x = 0
y = 0

# initialization function
def init():
    print "==========================================="
    print "Celsius - Fahrenheit Converter, v1.0"
    print "~Made by jimkokko5~"
    print "==========================================="
    print ""
 
# define event handlers
def f2c(f):
    f = float(f)
    c = 5 / 9  * (f-32)
    print f, "degrees Fahrenheit is", c, "degrees Celsius"
    print ""
 
def c2f(c):
    c = float(c)
    f = 9 / 5  * c + 32
    print c, "degrees Celsius is", f, "degrees Fahrenheit"
    print ""
 
# register event handlers
init()

x = input("Convert Fahrenheit to Celsius: ")
y = input("Convert Celsius to Fahrenheit: ")

f2c(x)
c2f(y)

Full Code (Python 3.0)

# c = 5 / 9 * (f-32)
# f = 9 / 5 * c + 32

# define global variables
x = 0
y = 0

# initialization function
def init():
    print ("===========================================")
    print ("Celsius - Fahrenheit Converter, v1.0")
    print ("~Made by jimkokko5~")
    print ("===========================================")
    print ("")
 
# define event handlers
def f2c(f):
    f = float(f)
    c = 5 / 9  * (f-32)
    print (f, "degrees Fahrenheit is", c, "degrees Celsius")
    print ("")
 
def c2f(c):
    c = float(c)
    f = 9 / 5  * c + 32
    print (c, "degrees Celsius is", f, "degrees Fahrenheit")
    print ("")
 
# register event handlers
init()

x = input("Convert Fahrenheit to Celsius: ")
y = input("Convert Celsius to Fahrenheit: ")

f2c(x)
c2f(y)

Thursday, May 2, 2013

New track recording!

A couple of days ago, Stranger, me and some other guys, recorded our first track. It took me a lot of time to mix and master it, and it was recorded in my house, which means that we didn't have the best equipement or instruments there are. It turned out pretty well though, and we will make a video and upload it to YouTube sometime soon. Here's a screenshot: