15,887,477 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by simple world (Top 30 by date)
simple world
1-Jun-22 4:16am
View
I want at the begining to have the same number of enemies, the the enemies fight each other and when a enemy from lets say the attackers array dies, then the extra enemies from the deffenders array go to another enemy to fight, and so on.
Do you have any advice?
Thank you for your time
simple world
1-Jun-22 3:54am
View
Yes i saw your update thank you.
But if i dont increment the j variable then the gameobjects position in the deffenders array only goes to one gamobject of the attackers array. Imagine i have 10 "enemies" in the Deffendes array and 10 "enemies" in the attackers array, if i dont increment the j then all 10 enemies from the deffenders array will go to one enemie from the attackers array.
Hope it makes sence
simple world
1-Jun-22 3:50am
View
I do not understand what you are saying, wether its the attackers array or the defenders array in the for loop i get the same result, index out of bound, and the arrays can not be the same length, one will have more that the other.
Thank you.
simple world
29-May-22 7:47am
View
I figured out how to do that this is the code:
for (int i = 0; i < enemies.Length; i++)
{
enemyPos = enemies[i].transform.position;
for(int j = 0; j < playerPoints.Length; j++)
{
distanceBetweenPlayerAndEnemies = Vector3.Distance(playerPoints[j].transform.position, enemyPos);
if (distanceBetweenPlayerAndEnemies <= agent.stoppingDistance)
{
enemies[i].transform.position = playerPoints[j].transform.position;
i++;
}
}
}
PlayerPoints are just some empty game objects around the player, and the enemies just go there where they are close.
But now i have a new question, as soon as 1 enemy is close to the player then all teleport on those positions no matter how far, i tried to make it and if statement like if they are far then dont teleport them but it doesnt work.
Any ideas?
Thank you.
simple world
27-May-22 0:19am
View
I know about the coorinates, but i am trying to do that with an array and a foreach loop and i can figure how to get the position of many enemies.
LOOK AT THE CODE BELLOW
playerPos = player.transform.position;
foreach (GameObject enemy in enemies)
{
enemyPos = enemy.transform.position;
distanceBetweenPlayerAndEnemies = Vector3.Distance(playerPos, enemyPos);
if(distanceBetweenPlayerAndEnemies <= agent.stoppingDistance)
{
Debug.Log("Enemy has arrived");
enemy.GetComponent<navmeshagent>().isStopped = true;
}
}
As for why i want them to kill each other it is basically a strategy game where you stand back tell your troops to do something but everything will be in 3D, and if you decide to join the battle, i dont want you to be overwhelmed with the amount of enemies attacking you.
Thank you.
simple world
8-Mar-22 10:34am
View
Yes but how can i fix them? Jump speed is constant but here is connected with my speed and i cant tell why, when i delete the playerspeed variable the player can still move and i have no clue why
simple world
1-Feb-20 21:12pm
View
i updated the question
simple world
20-Jun-19 16:38pm
View
But there is a problem.
I want all of this to be done in the same page.
I will update my question so that you can understand better.
simple world
20-Jun-19 14:58pm
View
Thank you for replying but how can i take that number and pass it to php?
Actually that is my main problem.
simple world
19-Jun-19 15:05pm
View
Hey sorry the path was incorrect.
I fixed it and it worked great.
Thank you very much.
I accepted you answer as solution.
simple world
19-Jun-19 15:03pm
View
Hello thank you for replying.
I did what you said.
And this is the result.
unlink(admin/images/50.jpg): No such file or directory in /opt/lampp/htdocs/test/admin/delete.php on line 20
Not Working
I get error and the funny thing is that the path is correct.
What might be the problem?
simple world
15-Jun-19 13:34pm
View
No it doesnt.
Everything is in place.
I inspected the code and it is very good.
simple world
15-Jun-19 13:25pm
View
Yes.
I works great.
simple world
15-Jun-19 13:11pm
View
if i have 10 images in my database i get 2 divs with 5 images in them.
But if i have 11 images i get 3 divs, the first 2 have 5 images in them and the 3rd has 1.
simple world
15-Jun-19 12:52pm
View
Yes it works great.
I have 4 different div tags and each holds 5 images in it now.
And if i want i put more.
Again thank both of you.
simple world
15-Jun-19 12:44pm
View
Patrice T thank you for the help.
But the first post was what i was looking for.
I appreciate your help very much
simple world
15-Jun-19 12:42pm
View
Yeah This worked really well.
Thank you very much
simple world
15-Jun-19 12:33pm
View
i did it.
simple world
15-Jun-19 11:40am
View
Hello Thank you for your replies but no its not working as i need to.
What i need is this.
I have a database table with 9 images.
i want to display all this 9 images in 3 different tags.
something like this:
div
img
img
img
div
div
img
img
img
div
div
img
img
img
div
but everytime the published_images is setted back to 0 in the if conditions then it starts again from image 1.
What i want is to loop in the array that is returned and go 0,1,2 display them 3,4,5 display them 6,7,8 display them.
and imagine that the number of images in the database is NOT known so i cant just go echo array[index0] and so on.
I hope you understand me
simple world
1-May-19 20:42pm
View
Yeah i know.
First thing im gonna do is read a few pdfs to learn some c# first.
I accepted your answer as solution.
simple world
1-May-19 20:38pm
View
Well i guess i still have a lot to learn. Thanks a lot :)
simple world
1-May-19 20:30pm
View
Well i just finished my internship so i decided to start learning ASP.NET MVC but because i am a total beginner even in c# i thought i would do something like this just as a test project and then slowly build in it the classes that i need just for education purposes.
But i dont know how to close the db connection and there is almost zero information about razor pages online.
So what do you suggest?
simple world
1-May-19 20:23pm
View
Have a look at my AddProducts.cshtml page and you will understand.
@{
Layout = "~/_Admin/_SiteLayout.cshtml";
Page.Title = "Προσθήκη Προιόντων";
var db = Database.Open("rentit");
WebImage photo = null;
var newFileName = "";
var imagePath = "";
if (IsPost)
{
//Getting TextBox value in string
string ProdName = Request.Form["prodname"];
string Cost = Request.Form["cost"];
string Description = Request.Form["desc"];
string Details = Request.Form["details"];
string Class = Request.Form["class"];
string Fuel = Request.Form["fuel"];
string Doors = Request.Form["doors"];
string GearBox = Request.Form["gearbox"];
photo = WebImage.GetImageFromRequest();
if (photo != null)
{
newFileName ="_" +
Path.GetFileName(photo.FileName);
imagePath = @"/images\" + newFileName;
photo.Save(@"~\" + imagePath);
}
var sqlinsert = "INSERT INTO Products (ProdName,Cost,Description,Details,Class,Fuel,Doors,GearBox,ImagePath) Values(@0,@1,@2,@3,@4,@5,@6,@7,@8)";
db.Execute(sqlinsert, ProdName.toGreeklish(), Cost, Description, Details, Class, Fuel, Doors, GearBox, newFileName);
Response.Redirect("/_Admin/Products.cshtml");
}
}
And in every page that i need to RUID something in my database i am using the Database.Open(); in every file
simple world
1-May-19 20:18pm
View
EF is independent?
Because as i said i am working only with razor pages not with any mvc or core.
And i dont have any controllers at all.
All my files are purely .cshtml files.
simple world
30-Apr-19 17:39pm
View
it goes in the IsPost statement applies the email and username and then it just goes to the page i said (Cars-List.cshtml) it doesnt go any ferther
simple world
24-Apr-19 11:30am
View
Let me explain it better.
What i mean is that i want in my file explorer in the visual studio to have only razor and c# files.
I dont want to do anything with MVC or other frameworks.
All i want is to hard code every step of my project because i am still in the learning proccess of my career and need to know exactly what i am doing and why i am doing it.
That is the reason why i want to create a project where i will only have my razor views and the c# files to do the data proccess and logic.
But my main problem is how can i combine these two together.
For example how can a c# file that has a DB connection in it how can i use that in my razor view directly and run a query in the view without having to create a new db connection every time?
Thank you.
simple world
12-Apr-19 9:23am
View
Thank You. Your solution was exactly what i was looking for, and thank you for the useful links, you are right i need to learn a lot more.
simple world
14-Mar-19 9:02am
View
Could you please explain what else you need to help me ?
I can edit my post but i dont understand what is measing
simple world
14-Mar-19 8:45am
View
Can you help me a bit more? I barly understood what you said.
simple world
27-Feb-19 8:37am
View
@MaciejLos Hello Thank you for responding.
I did what you said but still i get multiple cookies and each cookie then it get as value the name=value.
And i dont know how to retrieve all the cookies that exist in the browser into a list so that i can loop through and be able to display them.
Show More