Question

UNITY QUESTION I am working with my team in Unity to create a character. I am...

UNITY QUESTION

I am working with my team in Unity to create a character. I am responsible for creating a character's moves. Nothing really has been done yet, but could you provide an example of code using C# or C++ or even pseudocode

Please provide functions for my character to go walk, run, move up, move down, move forward, and move backwards.

I will give a thumbs up if it is decent :)


Just give me an example code for how to perform these functions.

give me an example

Homework Answers

Answer #1

Here is the code in C to move character right, left, upword and downword using keyboard. May be this one help you.

Code :

#include<graphics.h>
#include<process.h>
#include<dos.h>
#include<conio.h>
void main()
{
int i=250,j=250,x=0,y=-1,ch,gd=DETECT,gm;
initgraph(&gd,&gm,”c:\turboc3\bgi”);

while(1) //infinite loop
{
outtextxy(i,j,"C");
outtextxy(400,400,”Press Esc to Exit…..”);

if(kbhit()) //check if a key is pressed
{
ch=getch();
if(ch==57) //move upward
{
x=0;
y=-1;
}

if(ch==61) //move left
{
x=-1;
y=0;
}
if(ch==63) //move right
{
x=1;
y=0;
}
if(ch==62) //move downward
{
x=0;
y=1;
}

if(ch==27) //exit when esc pressed
exit(0);
}
i=i+x;
j=j+y;

delay(50);
cleardevice();
}
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I am about to start my Dissertation for my Msc in Cyber Security course. However, I...
I am about to start my Dissertation for my Msc in Cyber Security course. However, I am still unsure of the topic I will pursue. Could you please give me a few examples of topics (Preferably IoT & Cybersecurity) and provide 3 characteristics of the research topic that makes it suitable for a master’s level research project. This would be really helpful and would enable me to start planning my dissertation. Thank You
Should you be able to see a bacteriophage on an inoculation loop? For class, I am...
Should you be able to see a bacteriophage on an inoculation loop? For class, I am working on isolating a bacteriophage and I feel at times confused on what I should be expecting. I labeled the clear zones that are suspected bacteriophage and when I rested my inoculation loop on top of the area, I see nothing and feel nothing (I don't know what I expected, but it just makes me apprehensive that I'm not doing this right?) I, then,...
Hello I am currently working on an informative speech for my class. My topic that I...
Hello I am currently working on an informative speech for my class. My topic that I will be speaking on is the importance of budgeting. I am came up with this outline so far: Specific Purpose: To inform the audience about the importance of budgeting - advantages Central Idea: Making a budgeting plan is easy and the most critical step - great tool Introduction Question: what’s more important to you? A daily Starbucks drink or a yearly beach vacation. Why...
Hi! I'm working on a project and struggling to piece my thoughts together. I am supposed...
Hi! I'm working on a project and struggling to piece my thoughts together. I am supposed to come up with a problem statement and research question regarding public policy. The example given is: Problem statement: • Governments have supported decentralized approaches of delivering social services. • Emphasized interorganizational collaboration to improve service integration and reduce fragmentation. • However, it is hard to evaluate how much collaboration is taking place among nonprofits and what extent they collaborate. Research Questions: • Why...
2. My monthly demand for cell phone service is as follows: − I am willing to...
2. My monthly demand for cell phone service is as follows: − I am willing to pay up to $1 per minute for the first 10 minutes of use per month. − I am willing to pay up to $0.50 per minute for the next 20 minutes per month. − For all minutes beyond the 30th (covered above), my demand is P = 0.50 – Q/100. P is in dollars and Q is minutes.(You should think of those as additional...
I keep getting error working on my project 2 MAT 243. What am I doing wrong?...
I keep getting error working on my project 2 MAT 243. What am I doing wrong? Step 3: Hypothesis Test for the Population Mean (I) A relative skill level of 1420 represents a critically low skill level in the league. The management of your team has hypothesized that the average relative skill level of your team in the years 2013-2015 is greater than 1420. Test this claim using a 5% level of significance. For this test, assume that the population...
Read the Following Case Study and Answer the Question Below Mandy L. Georgia I live near...
Read the Following Case Study and Answer the Question Below Mandy L. Georgia I live near a major highway on a mini-farm with chickens, ducks and goats. I have a domestic partner and two wonderful sons. I now love to sit on my porch, watching the chickens peck the ground and enjoying the sunshine. But, not too long ago, I used to sit on this same porch and think how easy it would be to walk into traffic. I suffer...
critique or respond to this persons disscussion on sex education------"the talk" SO>>>>MY OPINION IS THIS Households...
critique or respond to this persons disscussion on sex education------"the talk" SO>>>>MY OPINION IS THIS Households can fail a child in sex education, and also can go about it completely the wrong way, traumatizing the child, and hindering their development and self identification, self-esteem, and sense of self worth which we learned last week is crucial for the establishment of boundaries and healthy development of a person from one stage into another. Some households do not ever bring up "the...
Please read through the article below and answer the question at the end of the article....
Please read through the article below and answer the question at the end of the article. High-Performing Teams Need Psychological Safety. Here’s How to Create It “There’s no team without trust,” says Paul Santagata, Head of Industry at Google. He knows the results of the tech giant’s massive two-year study on team performance, which revealed that the highest-performing teams have one thing in common: psychological safety, the belief that you won’t be punished when you make a mistake. Studies show...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...