Jump to content
  • 0

Moving player in mouse click direction


Rodrigo Reis

Question

Hey guys, i'm new here and I've been messing around with the source code for a couple days. I gotta say, i'm not a real csharp developer and my coding style is "old school", but I managed to make the player character move according the mouse direction when map is clicked. Personally I think it's boring and unecessary to move using the keyboard. I dont know if the engine was developed like that intentionally or the "move-by-mouse" wasnt implemented yet for the lack of time. I will post here a video captured from the game window with the character moving using the mouse click on the map, and if you think I should contribute to the main code with that functionality, I would do it gladly but I'm afraid to mess the whole code in the main branch. I changed only the intersect-engine\Intersect.Client\Core\Input.cs and Intersect-Engine\Intersect.Client\Entities\Player.cs but I had to change a private method to public and add some code. Here's the video: 

 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

The truth is that this has been a quite interesting implementation and more seeing that perhaps it can be extended to the skills system and be able to do effect skills with the mouse, what I do think is that this should be something configurable in the event that the programmers approve it, I encourage you to create the PR and continue with the discussion there and see the technical part regarding the code.

 

If you are interested you can also enter the community discord and we can talk about the functionality and the main developers can give you their point of view. https://discord.gg/ggjwhrANtG

Link to comment
Share on other sites

  • 0

Yea I have been looking into something like this. I remember JC saying on a twitch that the true click to move he did for Ambard was kind of complicated because of AI changes (I think). If we never see anything like that in the engine it would be nice for something like this.

 

Slightly off topic, but it would be cool to see things like you did here added in as plugins. 

Link to comment
Share on other sites

  • 0
10 hours ago, Blinkuz said:

The truth is that this has been a quite interesting implementation and more seeing that perhaps it can be extended to the skills system and be able to do effect skills with the mouse, what I do think is that this should be something configurable in the event that the programmers approve it, I encourage you to create the PR and continue with the discussion there and see the technical part regarding the code.

 

If you are interested you can also enter the community discord and we can talk about the functionality and the main developers can give you their point of view. https://discord.gg/ggjwhrANtG

 

Actually the code just emulates the direction keys, so the client just thinks its the user pressing the up-left-down-right controls many times. Yes I've been thinking of implement a "right-mouse-button" to use the skill selected in the hotbar.  I already made a fork to the source and uploaded the changed files but I dont really know if it worked. Sorry guys I'm new to Github and don't know how it works. Anyway the repository is https://github.com/rodrigoreisb/Intersect-Engine. In case the files are not uploaded, here they are attached to this post. I will join the discord, thanks.

 

https://www.ascensiongamedev.com/resources/filehost/be0c39be5933755cfdca432d9d75f6b8.cs (intersect-engine\Intersect.Client\Core\Input.cs)
https://www.ascensiongamedev.com/resources/filehost/91759e2d5b024a85482a77959deafa0f.cs (Intersect-Engine\Intersect.Client\Entities\Player.cs)
 

Link to comment
Share on other sites

  • 0

Ok guys I was really embarassed that I made such a poor job not testing the mouse movement with multiple maps. I made an effort and came up with a new version, now tested and I hope it works for everybody. The big problem was the map changes, becausa by what I could understand, every map has its own tile collection and the mouse functions get the value from that tile (example: map1 goes from tile (0,0) to (24,24) and so does map2. So, when we pressed the mouse on another map, we got coodinates belonging to that other map but treated as the current map.
I couldnt find a function to detect if the mouse was pressed over another map (altough I saw a similar function for entities). But the engine is great and I bet took a huge work from the developers. 
As I was already messing with it, I managed to make 2 new features: 1) the player follow the mouse cursos while standing (it's not perfect tough, I dont know why) and 2) select the spell from the hotbar, and use the mouse right button to launch it (select pressing the numbers 1 to 9 will not launch the spell).
I also added a 
I hope you all enjoy. I will post the edited files attached here.

https://www.ascensiongamedev.com/resources/filehost/080c9da3a04360845f6f49a1857dcd10.cs (Intersect-Engine\Intersect.Client\Entities\Player.cs)

https://www.ascensiongamedev.com/resources/filehost/d2c13825973d55b5da9ab8985e22b343.cs (intersect-engine\Intersect.Client\Core\Input.cs)

 

 

Link to comment
Share on other sites

  • 0
19 hours ago, demsoul said:

Can you make target icon on spell actually selected? and maybe something like cursor anim on click it would be very good but its just my idea B)

 

That's really a good idea, I thought of it but as I said before, I am not a real C# developer and the code is huge, and the engine have many features I never even tried (like crafting or customizing the skin). The movement-by-mouse itself is still kinda buggy, it would be better for the real developers to make it the right way from scratch.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...