Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Simple 4 way movement

hgi
Registered User
Quote
2017-12-11 22:46:16

Hey all,

Hopefully, it's just an easy one, but I'm looking to have a top-down game, and the scene node be controlled by keyboard (WASD).

However, I'm looking to have just a 4-way movement with the mouse depicting where shots are fired. So W always moves node upwards, A will always be left, etc.

The third person shooter player behaviour is almost what I'm looking for, however, I'm not sure if the script can be tweaked to accommodate.


niko
Moderator
Quote
2017-12-12 10:13:35

Ah, that's interesting. You could do this manually, by using "move to position" actions, this should work, I think.


techno-valley
Registered User
Quote
2017-12-12 11:55:00

If I do understand well, you can create a top view simple camera looking on your scene ground 90 degrees (perpendicular) and use normally the third person shoot movement.


hgi
Registered User
Quote
2017-12-12 12:36:44

Now I feel real dumb :P

Niko, I don't have that action, either in my regular list or when attached to say "when key pressed" actions. Uh-oh!

techno-valley, I did try using that but when you press either left or right it rotates the object. I'm looking for the scene node to stay in a fixed position (roation) and just move without rotating.

What I'm trying to do achieve is a top down shooter like Waves / Waves 2:

https://www.youtube.com/watch?v=...


tim12345
Guest
Quote
2017-12-12 22:33:11

hi hgi,
wild-master made a pretty good example of how to move an object with the WASD keys here. --> http://www.ambiera.com/forum.php...

however, this is frame-dependent movement, and you'll want frame-independent movement probably so I have explained how to do that here. --> http://www.ambiera.com/forum.php...

and finally, if you want to shoot in the direction of where the mouse is at on the screen... hm... that's an interesting one. I havn't tried that but you could start by getting the mouse position with javascript using this:

ccbGetMousePosX();
ccbGetMousePosY();


and then calculate the direction to shoot based on the position of the mouse.


hgi
Registered User
Quote
2017-12-14 19:58:13

Tim12345, thank you so much (would have responded earlier but I've been laid up in bed with the flu)

That is exactly what I'm looking for. :) thanks again

All the best


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact