Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Thomas Wiborg

Member Since 05 Jan 2013
Offline Last Active Yesterday, 04:55 PM

Topics I've Started

Terraria clone. What do I need to learn

27 August 2015 - 10:43 AM

Hello fellow programmers.

I want to make a terraria clone. Ofc in alot smaller scale. And i therefor wonder what kind of skills i need to learn to do so.

What is the difference between procedural generation of my map and perlin noise generating my map array. Ive tried out Perlin, to get my array filled with random numbers.
Are those the same thing or am i all wrong?

What other skillset do I need to learn?

Im newbie so go easy on me smile.png


Mouse pointer out of applicationresolution when running fullscreen

30 July 2015 - 05:58 PM

Im having some problems when running my application at fullscreen.

My game is currently running at 800x600 resolution. When im in windowed mode my mouse pos x and y is 0.0 upper left corner and 800.600 bottom right.
If im running my game in fullscreen its still 0.0 in upper left corner but at bottom right it changes to 1920x1080.
My mouse then follows the resolution of my screen and not the applications resolution.

 

Is there a way to fix this, maybe a workaround or something like that?

Here are my constructor for Game1.cs and Initialize

  public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            Window.IsBorderless = true;

            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;

            graphics.IsFullScreen = true;
        }


        protected override void Initialize()
        {
            Mouse.SetPosition(0, 0);

            IsMouseVisible = true;

            currentGameState = GameState.MainMenu;
            
            base.Initialize();
        }


Pong. Reflection of ball intersecting paddle

18 July 2015 - 03:17 PM

Hello all,

 

I have a newbie question.

 

Im using Monogame/XNA to make a Pong clone.

 

I want to reflect my ball when it hits the paddle. If it hits the middle i want it to reflect horizontaly. The closer it get to the edges i want it to reflect sharper and sharper.

 

How can this be done EASILY? ive tried using angle/radians etc, but i just cant get the hang of it. Can i use any of the C#/XNA/Monogames inbuilt library to do this? Or is there some other way?

 

Ive googled up and down, but i cant find any article that is easily explained :)

 

Ofc, when it reflects and hits the wall i want it to keep the angle untill it hits the other paddle.

 

Thanks for all replies!


Monogame, Ray Intersection not working correctly

19 June 2015 - 04:27 PM

Hello,

Im having some sort of trouble with my collision detection when using Ray.
I have a enemy which follows my player. If my player moves horizontally or vertically of my enemy, the intersection works flawless. It finds the center on my player and stops on top of him. The problem starts when the enemy chases my player diagonaly/sideways.

When it then hits my player it starts vibrating, and dosent seems to hit my players BoundingBox.
 

Here is my code. Ive done some breakpoints and found out that when the "enemyToPlayerNormalized" direction is something else than 0 or 1, meaning decimal for example x = 0.5346, y = 0.2453 (then going sideways)
The "enemyToPlayerRayDistanceResult" wont recieve any results, It then returns "null".
What can I do so my "enemyToPlayerRayDistanceResult" recieves a result when the direction is something else than 0 or 1?
 

public void EnemyToPlayer(Vector2 enemyToPlayerNormalized)
        {
            //Creating a ray which has enemy position and tracks down the direction to the player. Enemy to player direction is normalized to get unit vector 1
            Ray enemyToPlayerRay = new Ray(new Vector3(enemy.TextureBoundingBox.Min.X, enemy.TextureBoundingBox.Min.Y, 0.0F), new Vector3(enemyToPlayerNormalized.X, enemyToPlayerNormalized.Y, 0.0F));

            //If there is a chance for my enemy to hit the players bounding box, it will return a float value of the distance between them
            var enemyToPlayerRayDistanceResult = enemyToPlayerRay.Intersects(player.TextureBoundingBox);

            //moving the enemy
            enemy.position += enemyToPlayerNormalized;

            //If it has a value and is less than 1 away from the player, it will set its position to the player.
            if(enemyToPlayerRayDistanceResult.HasValue && enemyToPlayerRayDistanceResult.Value < 1)
            {
                enemy.position = player.position;
            }   
        }

Collision Detection and Camera movement. C#/Monogame

23 April 2015 - 09:18 AM

I have currently made a very simple game.

My gamescreen is made up with tiles 32x32 which is random positioned.

I also have a player which i can move in all directions.
And thats about it.

 

1. Where do I start now, how do I make some of my tiles able for my player to collide with? I have my tiles in a 2d array with indexnumber 0, 1, 2, 3 (for different sprites).

 

2. How is it possible to make a camera which moves if my mouse go faar to left or right, AND follow my player around.
    My screen size is set to 800x640px, but i have tiles which goes 3200x3200px.

 

Ive added a picture of my game, yeah I know, having (Information) button as player is lame :)

 


PARTNERS