Jump to content

  • Log In with Google      Sign In   
  • Create Account

beatlefan

Member Since 26 May 2011
Offline Last Active Aug 19 2012 05:35 PM

#4910869 XNA equivalent of glVertex2f()?

Posted by beatlefan on 08 February 2012 - 05:58 AM

Those equivalent calls don't exist in xna (im 99% sure). For your case look into VertexPositionColor and DrawUserPrimitives. So its kinda like setting up vertex buffer in OpenGL except you don't use a vertex buffer unless you need/want one.


#4850518 Starting Language

Posted by beatlefan on 17 August 2011 - 04:47 PM

take a look at this.


#4849546 Simple Online C#/XNA Game

Posted by beatlefan on 15 August 2011 - 02:34 PM

I suggest looking into Lidgren networking library.


#4849064 Jframe for Java game?

Posted by beatlefan on 14 August 2011 - 12:46 PM

I did use that but would it hurt making a game with normal java no libraries ?


No your fine without using any additional libraries. When I used Java I didn't use anything extra.

You might find these interesting. The ones that involve creating the screen might be useful.


#4842902 Website with free sounds that i can use in game?

Posted by beatlefan on 31 July 2011 - 01:37 PM

And theese sounds is free to use? I can even realease a paid game with theese sounds?


Depends on what the author licenses them under. Some will allow you to use them in your game, but require you to mention them in the credits, others are completely free. Just make sure you check what license the author puts the work under and act accordingly.


#4842684 Which route to take

Posted by beatlefan on 30 July 2011 - 06:29 PM

Java would work perfectly fine, not sure what you mean by it not being able to handle the logic. I'm personally a big fan of C#, as it has the productivity of Java, yet it is more powerful than it. As far as I know you can't do in browser games with it though.


#4842629 Tips or Tricks for learning about programming?

Posted by beatlefan on 30 July 2011 - 02:44 PM

After reading over your original question a few times I think I understand what it is. You want to learn tips or tricks for learning about topics that involve programming, and not actually learning how to program. Is that what your are trying to ask?

If so I guess you should learn to use Google and do research about whatever. Using your example of:

Hmm for example when i want to do applications its good to not only know Java for example you can get to know more libraries and use stuff like OpenGL and DirectX but i have no clue which one is best to use and which one should i aim on learning it?


So you should research about the pros and cons of each one, and find which one suits your needs. An example would be: say your a windows only user, so the cross-platform ability of OpenGL wouldn't matter that much to you.


#4841883 Need some advice

Posted by beatlefan on 28 July 2011 - 04:27 PM

but unless you have a couple of grand to throw at that kind of software, it'll probably be out of the question.


You can get most (at least a pretty big portion) of Autodesk's products (3ds Max, Maya) for free as student.

Also, you can use Paint.NET(free) for all your texture and 2d needs.


#4841750 Scripts in games, What for?

Posted by beatlefan on 28 July 2011 - 12:20 PM

I have a game that i made but i whant to add some features through scripting so users can change it whenever they whant to modify the game.. But i don't find any good language for it.


Well how much would you want users to change? If it's just a few small things such as health or speed of a unit you could have a text file that has an XML-like structure where you could change the health or whatever. Then when the game run's it loads that file and sets the units stats accordingly. Doing this is simpler than adding a whole script engine and stuff, at least I would think so.


#4841630 Scripts in games, What for?

Posted by beatlefan on 28 July 2011 - 09:04 AM

But Python would work also with Java ?


Yes, that's what Jython is for.


#4841239 XNA C# Engine deadend

Posted by beatlefan on 27 July 2011 - 01:04 PM

You should make gameobject an abstract class
public abstract class GameObject //usually people use uppercase letters at the beginning of each word for classes
{
	//the code you have

	//now we should make a constructor
	public GameObject(Texture2D texture, string name, string type, Vector2 position) // and whatever else you need such as health
	{
		texture2d = texture;
		this.name = name;
		this.type = type;
		//and so on
	}
}

then for your zombie
public class Zombie : GameObject
{
	public static Texture2D ZombieTexture;
	
	//make the zombie constructor
	public Zombie(Vector2 position, string name)
		: base(ZombieTexture, name, "zombie", position) // this calls the parent class's constructor ( GameObject)
	{
		//dont really need to do anything here
	}

	public override void Update()
	{
		// Update logic for zombie
	}

}

Then for your test_add_object_to_test_screen() function
public void test_add_object_to_test_screen()
{        
        	samwise.gamescreen screen = game_engine.get_gamescreen("test_screen");

                int i = 1;
        	Zombie.ZombieTexture = Content.Load<Texture2D>("zombie");

                while (i < 10)
                {
                	samwise.gameobject test_object = new Zombie( new Vector2(i * 100, 0), "zombie" + i.ToString());

                	screen.add_object(test_object);
                	i++;
                }
}




#4840776 Array Example?

Posted by beatlefan on 26 July 2011 - 02:06 PM

static void Main()
{
	int[] intArray; // declares an integer array
	int[,] twoDArray; // declares and 2d dimensional integer array

	intArray = new int[5]; // initializes an array that can contain 5 integers
	intArray[0] = 1; // sets the first item in the array to equal 1, arrays in C# are zero-based meaning that you count 0, 1, 2, 3, instead of 1, 2, 3

	twoDArray = new int[2,4]; // initializes the array
	twoDArray[0,0] = 4;
	twoDArray[1,3] = 3;
}

Does this help, or is there something else you don't understand?



Edit:

Also to loop through an array you can do:
for(int i = 0; i < array.Length; i++) // you do less than the length of the array since arrays are zero based
{
	Console.WriteLine(array[i].ToString());
}

//alternatively you can do a foreach loop
foreach( int number in array) // this will take every element in the array as an integer and name it 'number'
{
	Console.WriteLine(number.ToString());
}

//I suggest you use for loops instead of foreach loops, as for loops are faster, and foreach loops can cause
//  problems in certain situations



#4840358 C# Game Set Bonuses

Posted by beatlefan on 25 July 2011 - 08:46 PM


How would using enums instead improve what I have now? I can probably get rid of those bools..



Truly, I don't think it will make that much of a difference, but it would be a tad easier for you, maybe.

What you can do is something like this:

public enum Items
{
	DevSword,
	DevBeanie,
	DevShirt,
	DevPants,
	// and so on
}

Then have the player class have a list of Items, and when they buy something add whatever it is to that list
//buy sword
player.items.add(Items.DevSword);
Then to check if the player has the item
foreach(Item item in player.items)
{
	if(item == Item.DevSword)
		return true;
	else
		return false;
}


You could also make an Item class since your items have a price, it would be more code though, such as this:

public enum ItemType
{
	DevSword,
	DevBeanie,
	DevShirt,
	DevPants,
	// and so on
}

abstract class Item
{
	public int Cost { get; protected set; }
	public ItemType Item { get; protected set;}

	public Item(int cost, ItemType type)
	{
		Cost = cost;
		Item = type;
	}
}

class DevSword : Item
{
	public DevSword()
		: base(1, ItemType.DevSword) // cost and Type
	{
	}
}




#4840194 WinAPI and DirectX tutorials ?

Posted by beatlefan on 25 July 2011 - 02:59 PM

though i never learned about C++ classes(LOL).


You definitely need to learn classes if you want to be anywhere close to a good game programmer or maybe even programmer in general. It took a while for me to understand the idea of classes, but once it clicked, it helped so much. So learn classes, then learn DirectX.


#4839391 When am drawing background it gets drawn over all other images..

Posted by beatlefan on 23 July 2011 - 04:49 PM

Wow.. That actualy worked.. Would you mind telling me how?? super doesn't draw anything.. It just make sure if you use the variable names in different methods there will be no errors?

I don't understand please tell me.


super.NameOfFunction() calls the parent class's function, so super.render() probably draws or does something.




PARTNERS