Jump to content
  • Advertisement

tomd1013

Member
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

148 Neutral

About tomd1013

  • Rank
    Member

Personal Information

  • Interests
    |programmer|
  1. tomd1013

    Snake using SDL

      Just to add to this, it's best to make class variables private unless they need to be public for some reason. Getters and setters are the way these variables are handled, usually. For a private variable int X of class myClass, here is a sample getter and setter: int myClass::getX() { return X; } void myClass::setX(int newVal) { X = newVal; } The functions getX() and setX() are public. This reduces the chance of accidentally changing values when they shouldn't be touched. 
  2. tomd1013

    How Does One Learn C++ ?

    When I began learning I thought TheNewBoston, a YouTube channel, had a pretty easy to understand tutorial series on C++. It was at a simple enough level that I was able to understand how the language worked. After learning from a simple source, I moved on to more thorough explanations. ChiliTomatoNoodle, another YouTube channel, is the next source I used to learn C++. He has some really good C++/DirectX game programming series.  Currently, I am going through the Handmade Hero series on YouTube. This person seems to be at the level of knowledge for general programming and game programming that I am trying to reach. 
  3. tomd1013

    I need coding help please!

    I think frob was correct. Your rightBoundary should probably be declared as in this example: https://docs.unity3d.com/ScriptReference/Camera.ViewportToWorldPoint.html   Something like  Vector3 rightBoundary = Camera.main.ViewportToWorldPoint(new Vector3(1, 1, distanceToCamera));   I think using (0, 0, distanceToCamera) gives you the bottom-left point and using (1, 1, distanceToCamera) gives you the top-right point. The x coords of those should be the xmin and xmax, respectively. 
  4. tomd1013

    collision

    Maybe ask more questions if you've been working on stuff. You could show your code for critique.    Also don't get stuck thinking about how you're going to implement something, you have to actually work on implementing some of it too. 
  5. I've never used Game Maker Studio, but it seems like you're looking for this: https://docs.yoyogames.com/source/dadiospice/001_advanced%20use/more%20about%20rooms/views.html   At the bottom of that documentation page, it discusses object following for a view, so your player or whatever you want would be the object to follow.    If you give more detail about how it is set up, I might be able to give a better explanation. Hopefully this helps though!
  6. The first part of programming in my mind is knowing the tools that are available to you in the language. You eventually learn the most common tools after you write code that is really gross like the tic tac toe code you posted. Looking back at your code probably made it obvious to you how important arrays and loops can be.    Then, when you know what tools you have, you have to decide what you want to make. That can be a very difficult task if you're not very creative like me.    A suggestion on a small project that I had fun doing when I was still basically a novice programmer, would be making a text based adventure game. I didn't want it just to be text prompts, so I made a map and movement system too. You could definitely do it at your current level of knowledge.    It should output something like this:   ---------- -@-------- ---------- ----------   - = empty tile @ = player's position   The tile map would be stored in a 2D array. You could have a cin that checks for WASD and changes where you draw the player the next time. Can you think of how you could keep track of that?   Then to answer your last question about left-brained and right-brained people, I think there is something to it, but it can be overcome with enough time. I have gained enough skill in programming that I can have a job in the field, but I am not a natural at it like some of the people I've met. The key to learning something you're naturally bad at is to have a lot of curiosity and have people around to explain things (eventually documentation can replace most of the explanations).
  7. tomd1013

    How to start Working towards making games.

    For videos, I like the Handmade Hero series on Youtube. The guy shows and explains good ways of general game programming stuff from scratch.    If you're looking to do C++, the SDL library is pretty easy to use for 2D stuff.   https://www.libsdl.org/release/SDL-1.2.15/docs/html/reference.html   I can explain specific parts of using SDL if needed. I've been using it in my spare time. 
  8. tomd1013

    Graphical Libraries for Python 3

    I messed around with pygame a while ago and got basic 2D stuff working.    The basic things needed are: """ Imports """ import pygame as pg """ Class Game """ class Game(): def __init__(self): self.gameLoop = True pg.init() self.screen = pg.display self.screen.__init__("directx") self.screen = pg.display.set_mode([1062, 600]) self.mySpriteImage = pg.image.load("C:/sprite.png") self.mySpriteRect = self.mySpriteImage.get_rect() def processInput(self): """ Mouse input """ click = pg.mouse.get_pressed()[0] if click: p2 = [pg.mouse.get_pos()[0], pg.mouse.get_pos()[1]] """ Keyboard input """ keys = pg.key.get_pressed() if keys[pg.K_ESCAPE]: self.gameLoop = False if keys[pg.K_a]: elif keys[pg.K_d]: if keys[pg.K_s]: elif keys[pg.K_w]: """ Main Function """ def main(self): """ Main Game Loop """ while self.gameLoop: """ Handle Input """ pg.event.pump() self.processInput() """ Update Game Objects """ """ Update Game Screen & Draw """ self.screen.fill(Constants.Constants.color_black) self.screen.blit(self.mySpriteImage, [0, 0]) pg.display.flip() """ Game Exit """ print("Game Exit\n") pg.quit() Here, I just stripped down a simple project I had. Just a skeleton of basic game loop, user input, updating display/drawing images to display.   I usually program in C++, so sorry if this is ugly Python.
  9. There isn't much detail I can give based off what I saw of your code, but this is what I can say.   You have an Array of objects in your code, you are trying to get the X and Y value of a Rectangle from that Array. Do you know which Rectangle it would be that you need the X and Y of? If you do, it would be   float X = arrayName.get(indexOfRectangle).getX(); float Y = arrayName.get(indexOfRectangle).getY();   If you give a more specific definition of what you have and what you're trying to do, I can try to help more.   https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Array.html https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Rectangle.html
  10. tomd1013

    collision

    The method you were trying in the stub code you submitted didn't seem to be the best implementation. What does your stub code look like now?   LennyLen's method would be the best implementation to start with, I think.    The basic idea I would go with is: - bullet has an X and Y position(int, float, etc.), and isFired(boolean) - brick has X and Y position(int, float, etc.), isActive(boolean), and width and height (int, float, etc.) - button press sets bullet's isFired bool to True - update function checks bool for bullet(s) and moves it up a bit when needed - update function checks if bullet X and Y are inside any of the (active) bricks, if it is in a brick change that brick's isActive to false - draw everything to the screen (except bricks that aren't active)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!