Ascii console game: player character - c#

I've been working on a game for a while now. It's an ASCII game in the console, using C#. It's a bit like the old top-down zelda games. I've managed to get the map to draw, the movement system works and I've added random encounters.
Since I am still a beginner, I don't know how to use classes yet, so the game is programmed entirely without them.
My player character currently is still just the cursor, but I would like it to be a bit easier to see. It could be a white "#" symbol or something. The map is in color, so after the # symbol moves, the right tile, with the right color should be placed back at where the character was. I've tried quite some times, but I simply haven't been able to figure out how I can get this to work.
So my question is: How do I draw a white "#" character where the cursor is on the map and how do I make sure it doesn't leave the map changed when the "#" symbol moves as the player moves?
If you need any more information, simply tell me and I'll post it.
Thank you in advance!

I believe what you are looking for is a good combination of Console.SetCursorPosition and Console.Clear. Try experimenting with that.

Related

Problems when snapping two objects

I wanted to align the intersection object and the road object. But when I used v and the move tool on my keyboard, they didn't match each other. The road object was moved far away from the intersection object so I guessed the problem here was because of the intersection object, the original image was a square so the road moved to its apexes. How can I fix this? and sorry about my grammar, it isn't good.
the image of problem:
https://i.stack.imgur.com/BsIuh.png
the intersection object
https://i.stack.imgur.com/nmbOg.png
I don't usually use snap functions, because I prefer to change the transform manually. To align them it is enough that the position x is the same for both. If you want something more automatic, you can quickly create an editor script that positions it automatically.
If I helped you, you can thank me accepting this answer :)
Good work!

How to make dynamic shape adjustment to another shape

Hi guys i was wondering how to create a shape adjustment with two objects which specifically could be described as the independent cells, one of which is static, and the second one is dynamic and surrounded by "plasma". The movement of the active object must be controllable by the user (WSAD). Collision of the active object with the static one causes the static object to be swallen, though doesn't change it's position stays in place all the time. As the active object moves, passes the swallen object and troughts it out.
See the image below:
Player character
When it comes close enough to pink enemy it's starting to swallow it (surround by yellow thing)
Pink enemy is completely sourrounded when red circle is in the centre of both.
When it leaves enemy it takes off the yellow thing
I was wondering what is the simplest way to do it. I've been thinking about cloth, physics joints, mesh substraction (is it even possible?), some kind of animation... I don't have much time to do it. Can you show me the simplest way. Which tools and approach should i use? I'm not asking for full code or full solution only for some tips.
Tim Hunter mentioned a wonderful way, most perfect in 3D.
You can use another approach in 2D :
Inside OnCollisionEnter2D try finding hit points using Collision2D.contacts . See this reference .
Create some particle effect there.
Disable the enemy
Now play swallowing animation of the player.
At animation end, enable enemy again.
Maybe calculation is little tricky, still efficient.

How to make object follow waypoints to a center point?

Im not sure how to approach this and looking for suggestions - I have a moving box (moved by the user) with paths cut into it, and a character that traverses the paths. The moving box moves as well as rotates.
At all times, I need the character to follow the paths (NOT walk thru walls) to get back to a point on the box that is
facing the screen (even when the box rotates)
Middle of the screen (even as the box moves up/down)
Here the circle scribble is the character:
What would this be called/any approaches? Is this a waypoint system or something more complex?
A nav mesh would be better if you wish to make a more complex AI for the other character say if you wanted the character to chase the player. If your route is predefined then using waypoints will be the most efficient way of creating what you want in this scenario. Here is a good tutorial by Brackeys of how to implement waypoints.
https://www.youtube.com/watch?v=aFxucZQ_5E4

Project to track on screen object - Unsure how to go about it

I've started learning c# and vb.net and have a project related to tracking a moving object on the screen to help me learn some basics.
In essence, I will have a ball on the screen which moves from left to right (only horizontally), and when it reaches a certain point (e.g. 250 pixels from the "mid" point either side) I need to know this, and click an on-screen counter to increase a value (or decrease depending on left or right) and reset the ball to the centre (note that the ball speed will vary from incredible slow to an instant "jump").
I've been asked to look into c# and vb and decide which is best, then use it to create the program. As a complete newbie in both of these, does anyone have a recommendation and a starting point please?
My background is Javascript, HTML and very basic Java.
Thanks!
Not too sure what you define as a "Starting Point" do you mean like different C# libs to use etc. If all you are trying to do is move a ball from left to right basically and count the difference it would be so simple to do in C# XNA.
You can also do it in windows forms too which I really thing shouldn't be too hard at all. Obviously you would create the velocity formulas yourself I don't believe that's what you're asking.
One way to get the screen size in windows forms is:
public Rectangle GetScreen()
{
return Screen.FromControl(this).Bounds;
}
This will return a rectangle with a width and height that you can call, divide both values by 2 and it will give you the center of the screen. Then just add a method that is called every frame to check the balls value from the middle of the screen.
From what I've read I understand what you want to do, but I'm unsure if you just want a windows form or if you'd prefer to use a small game engine like XNA etc.
Either way best of luck and let me know :)

How to simulate a card been played in a card game?

I am developing a card game using WPF and since i do not have any knowledge about animations i would like to know if someone could help me in how to write an animation to simulate a Card ( Image ) been played over a table.
At the bottom and top of my game table i have my cards on vertical position.
At the right and left my cards are on horizontal position.
What i really want is give an impression that a human is selecting and throwing the card.
Since your question is pretty open-ended, I'll give you an open-ended start...
Look into Storyboards, and how to use the same to modify the RenderTransform of your Card UserControl.
Your first step should really just be animating your card's position from its initial spot to the center of the table. As an additional hint (which will come in handy after you've learned about Storyboards), your DoubleAnimation.From property does not need to be specified. You just need to specify the DoubleAnimation.To property.
I see questions like this all the time on SO, and it really does give the impression of "I haven't tried, and I have not read anything". You already have your cards on the table (so to speak), and the question is, make it look like a human did it.
There are a variety of ways, some cheap and simple, some more complex and involved. You won't know the answer until you try.
For example, perhaps you want a card to go from one position to another (optionally flipping). You have varying degrees of difficulty here:
Move the card to the position, as is. Cheap and easy. You could even use the distance between the source and the target to determine the speed to have some kind of residual momentum.
Cards are at different angles. How do we rotate? XNA makes this pretty simple, have you looked up on XNA and general rendering? Or do you want to this purely using WPF?
Does the move involve showing the card face-up, or not? Will there be an animation involved? Are you happy with just the face changing or do you want to see an actual "flip"? If it's the latter than some kind of a plane in XNA using 3D might be better, at least then you can have two faces with two different textures.
What I am saying is, and why this is an answer as opposed to a comment, is that you have given no indication of anything that might be considered trying to solve the problem. You seem like you've got halfway there, you've already got cards rendered on the screen. But to ask "Make it look like a human put a card in"...? Well, sorry... it's not that simple. You can make this task as easy or had as you wish.

Categories