Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Jaap85

Member Since 01 Sep 2011
Offline Last Active Jun 28 2015 04:37 AM

Topics I've Started

Resolution for different PC's, where to start?

22 June 2015 - 12:10 PM

Hi everyone,
 
A few weeks ago i was finally able to upload my first game to gamejolt.com so others could try and play it. The first feedback i received however, was the fact that the game wasn't working beyond the main menu.
 
I tried to replicate the problem and discovered the following. When i play the game on my own laptop in resolution 1366*768 (the resolution i developed in) everything works fine. However, when the game runs on a different resolution (1920*1080) the buttons i created won't activate when clicked. I fixed this by running the game in windowed mode (not fullscreen). 
 
How can i have the game run in full screen mode on any resolution? And how can i know what resolution to use for each user? Or is this so complicated that it is advisable to run the game in windowed mode?
 
Below you can find my code for drawing my buttons and processing the clicks. Note that everything is working fine in the correct resolution.
 
Thank you in advance for your ideas and guidelines!
 
The relevant part of the drawing method
// Draws the button background
spritebatch.Draw(texture, DrawRectangle, sourceRectangle, Color.White);

 
The relevant code of the update methode
// Process clicks
Boolean mouseInDrawRectangle = DrawRectangle.Contains(new Point(world.MouseState.X, world.MouseState.Y));

// Mouse up on button
      if (world.MouseState.LeftButton == ButtonState.Released && mouseInDrawRectangle == true)
          if (state == Enums.ClickState.mousedown)
          {
              state = Enums.ClickState.selected;
              buttonClicked = true;
          }
      else
            state = Enums.ClickState.hoover;



Card game Class Structure

17 March 2015 - 01:38 PM

Hi everybody,
 
After a short pause i recently picked up programming for fun again. I am currently working on a collectible card game (like MtG but then with a somewhat smaller scope ;-).
 
The thing is that i am unsure how to create my class structure. Right now i have a class called Card and some subclasses for (for example, when staying in MtG terminology:  an Instant).
 
However, when i am adding my cards, i have to use a lot of Switch statements. For example (still using instants from MtG):
 
Switch (card)
 
case Lightning Bolt:

  dealDamage(3)

case Terror:

  destroyCreature(creature)

 

Of course this is completely impossible to manage with a lot of cards. What would the class structure of MtG look like:

 

- Object

- Card : Object

- Sorcery/Instant/Creature : Card

- Terror, Lightning bolt, etc : Instant

 

So in the end you would get approximately 500+ classes. That doesn't feel right either.

 

What is the solution here?

 

Thank you very much in advance!


The next step?

20 July 2014 - 01:18 PM

Good evening everybody,

 

A few years ago (about 2) i got back into game development after only having toyed around with it when i was a teenager. My objective is absolutely not to make any commercial quality games or even make money by developing games, i just love to try and build stuff that runs on my computer screen and games are the things which interest me most.

 

After reading a lot of posts on these forums i created my first few (relatively simple) games. Of course I started with Tic-Tac-Toe, then moved on to a really small 2D action game where you had to throw presents down chimneys (based on the Dutch concept of Sinterklaas) and finally some 2D tilebased games (an RPG and a small business simulation game). 

 

While i really enjoyed making these games, i also ran into a problem. Right now i am able to create small games (of course only to my own standards), but when i try to make something bigger, i mostly run into the problem that i lose control of my code. My code gets messy and i can no longer find all the classes, methods and objects i created. 

 

I would really like to solve this issue but i am not sure how to do this. I learned programming by reading some online tutorials and then just jumping in head-first. Another thing that really helped me was the MOOC Beginning Game Programming using C#. I would really like to continue learning to fix the problem mentioned above, but most resources available seem either too advanced for me (and therefore irrelevant) or too simple (since i am just past the beginners course).

 

Does anyone have an idea how i could procede in this situation? I realize the question is kind of vague, but maybe someone who struggled with the same issue could offer some advice.

 

Thank you very much in advance for your response!

 

 

PS. My current programming language is C# (XNA) and for the games i want to make, well let's say i prefer Civilization over Call of Duty; Football Manager over FIFA and HearthStone over WoW. I hope that says enough ;-)

 

 

 

 


Class inheritance?

29 December 2013 - 09:57 AM

Hello everybody,

 

It's been a while since i have visited this forum, good to see it is still so active.

 

I have recently picked up game programming again and i am currently working in C# (XNA). I try to create a simple flying shooter game (Raptor clone).

 

Right now i am implementing the enemies and i would like to know what the best programming standard is for implementing the different types of enemies. I have already created a class "Enemy" which holds all the functions and variables needed for the enemies (such as the movement function, etc.)

 

I will create different subtypes of enemies, which differ in (for example): image, speed, firing rate, hitpoints, and so on.

 

What is the best way to implement is? I was first thinking of creating a separate class for each enemy type, which inherits from the enemy class, but that might be cumbersome.

 

Another option could be to just use the enemy class and assign every enemy a type when it is constructed, then work with lots of switch statements in the class based on the enemy type.

 

Is this the best way? Or is there a better way to do this? I feel a better way should be possible, but i cant really figure out how yet.

 

Thank you in advance for your replies. 


Freeing up memory

26 September 2012 - 02:43 PM

Hello everybody,

I just created a small test program to see how it would worked after i compiled it. The program was created in Visual Studio using C#. The main thing it does, is adding content from a web page (by reading html source code) to a list.

At some point in the program, i try to remove items from the list (to clear memory usage). However, i run into a problem. I want to remove all items in a list that meet a certain criterium. My code is as follows:

foreach item in list:
> if item.status meets criterium
> list.remove(item)

However, this code doesn't work. The error i get is that i am not allowed to alter the list inside the for loop.

How could i fix this problem? Right now my (very simple) program uses about 2 GB of memory after running for an hour or so.

Thank you very much for your ideas and advice!


PS. if removing items of the list probably won't fix my memory issues i would be happy to hear any other ideas or tips.

PARTNERS