• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

263 Neutral

About Jaap85

  • Rank
  1. Thank you very much for all the advice! I changed my code to get the values of the screensize dynamically (before that i hardcoded them to 1366*768). I just needed to find out the simple GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width line to fix it.
  2. 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;
  3. Hi everyone,   I would love to participate as part of a team. I am not very experienced and don't have too many free time, but it sounds fun to do and i would love to participate in a contest sometimes.   I have some coding experience in C# / XNA, but do not expect to much of it.   Happy to learn from the experience :)
  4. Card game Class Structure

    Thank you very much for the elaboration Xai, i will definitely keep these in mind when constructing my game. I now also see that this form of composition is quite related to an object oriented approach. Although i do have to improve my skills with interfaces and specific C# stuff like delegates, i get the global idea and should be able to get this working one way or the other.   Thanks again!
  5. Card game Class Structure

    great, thanks a lot! I will definitely give that a try :)
  6. Card game Class Structure

    Thank you very much for the responses everybody! Since i am quite new to this topic (and to programming in general), what would be the correct terms to Google for an example or maybe even a tutorial in C# for a compositional approach?
  7. Card game Class Structure

    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!
  8. The next step?

    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 ;-)        
  9. Class inheritance?

    All right, thank you very much for responding everybody :-)   If i try to summarize your findings, i come to the following conclusions: If the behaviour of all the different enemies is  the same, the best way to code everything is one of the following: Pass the type to the constructor, then use a switch statement in the constructor to set the different values Pass the different values directly to the constructor When considering these methods i prefer the first one, since it will allow me to create new enemies easier. An even more advanced approach would be to dynamically generate the enemies by loading them from an external data file.    If the behaviour of the enemies is different, composition is the best option. This is something new to me (i am not yet very experienced) but something i will definitely look into.   I hope the above is correct. Thank you very much for all your replies.
  10. Class inheritance?

    Thank you, i will look into that. I thought that such a method should exist but have never worked with if before. What is a good file format to use for such a file? XML? Any examples would be very much appreciated.
  11. 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. 
  12. Freeing up memory

    Sorry for my slow response (have been a bit busy with things other than programming the past few days) but i tried it out and it works! Where my program used to use up to 2GB, it now uses only 40 MB of processor power. Much better! Thank you very much for your responses.
  13. Freeing up memory

    Thank you very much for all the solutions. I will give it a try and see what happens!
  14. Freeing up memory

    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.
  15. I need some guidance

    If you like to get some guidance with your first project, but you don't want to create a platformer, you could try the book "Visual C# Game Programming for Teens". This helps you design a 2D RPG / dungeon crawler from the very beginning. Although it is not exactly what you are looking for eventually (which is i believe called 2.5D) it might suit you better than creating a platformer first. Or, depending on your learning curve, you could first finish the platformer, then the 2D RPG and finally move on to 2.5D.
  • Advertisement