How to turn the actor and make it move forward?

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
User avatar
ddabrahim
Member
 
Joined: Tue Aug 23, 2016 6:24 pm

How to turn the actor and make it move forward?

Postby ddabrahim » Fri Sep 02, 2016 4:13 pm

Hi all!

I would like to ask for some help.
What I'm trying to do is very simple (in most engines). When Left key is pressed, rotate actor left, When right key is pressed, rotate the actor right when forward key is pressed, move the actor toward the Direction it facing.

The problem is, when I try to move the actor forward, it is not moving toward the direction it facing but regardless the rotation it moving right on the X axis.

This is how I'm trying to do:

To rotate the actor:
Code: Select all
If Left control is pressed then Change Rotation Y = Actor("this").DirectionAngleY - 0.2
If Right control is pressed then Change Rotation Y = Actor("this").DirectionAngleY + 0.2


To move the actor:
Code: Select all
If Forward control is pressed then Take movement in Direction = Actor("this").Direction


And it doesn't work and I don't understand why. The actor is rotating, there is no problem but when I try to move forward it moving to the right regardless the rotation of the actor.
It seems to me even though the actor seems to rotate it direction is not changing but I have no idea what else I could try.

If I'm using the Turn event for some reason it just doesn't work at all, it doesn't seems to turn my actor, it doesn't do anything.
If I'm using the Move Backward/Forward event I get the same result.
If I'm using Change Angle event like so:
Code: Select all
If Left control is pressed Change Aim/look Angle Y = Actor("this").AimAngleY - 0.2

just like with Turn event, nothing is happening.
If I'm trying to use Change Direction event, I just can't make it turn but only change direction left, right, up, down or any specific Direction. I have tried to use:
Code: Select all
Actor("this").Direction - 0.2
to turn it Left but it was throw me an error message, it is not possible to use it this way.

I was also think about it maybe I should rotate on the Z axis instead of Y, but it doesn't work. I don't know how to describe but when I rotate my actor on the Z axis, it almost seems like my actor sprite is on the "side" of a 3D cube, and the cube rotates on the Z axis and so the sprite on the side it is just disappear as the cube rotates...

What else I could try, anyone could help me on this please?

I'm working on a top down view game and I'm looking for alternatives to the engine I'm using right now. I'm experimenting with 001 for a week now but all my attempts is a huge fail.
In 001 nothing works the same way as in most engines I have been using before. I have trouble get it done the most basic things. I'm really don't know if 001 is the right engine for my game, it just seems too much trouble to use it for anything other than an isometric game.
Should I give it more time or am I using the wrong tool for my needs or the right tool the wrong way?

Thanks.
Create 2D sprites from 3D models: http://3d2sprite.blogspot.com

User avatar
AnvilHouse
001 Support
 
Joined: Mon Mar 04, 2013 1:19 am
Location: Wisconsin, USA

Re: How to turn the actor and make it move forward?

Postby AnvilHouse » Fri Sep 02, 2016 4:25 pm

I accomplished this with my tank testing, here is my input scripting

https://www.dropbox.com/s/7vz38p6kkgadi36/Regular%20Game.1in?dl=0

All you have to do to get it to work is create 2 switches

Turn_Right
Turn_Left

It should be a good jump off point to get your 001 journey started ;)
Image Image Image

https://www.patreon.com/Anvilhouse ...yes...I am on Patreon!


-The store is under construction-
All items are guaranteed to work with 001 ;)

User avatar
ddabrahim
Member
 
Joined: Tue Aug 23, 2016 6:24 pm

Re: How to turn the actor and make it move forward?

Postby ddabrahim » Fri Sep 02, 2016 4:37 pm

Thanks a lot, but when I try to import your script it tells me the "resource is too new" and skip it when I try to import it :shock:
What does it mean, the version I'm using is out of date?


I guess it is.
Since you are a "beta tester" you might using newer version than me.
Can't you just make a screenshot of the events, or explain?

Thanks.


Okay, just to make it simple, let me ask this:

Code: Select all
RotationY = Actor("this").DirectionAngleY - 0.2
rotate the actor but the actual direction of the actor does not change.
Code: Select all
Direction = Actor("this").DirectionAngleY
set the direction to be the same as the rotation and technically it works, solve the problem I have but it causing the actor to be rotated on the Z axis instead of Y and just make it useless because the actor get rotated on the wrong axis.
Actually, the coordinate system is an other weird thing.
In most engines Z is the depth, X is the width and Y is the height and so, in theory I should rotate the actor on the Z axis if I want to rotate something from a top down view, but it doesn't look right in 001, to make it look right, the actor is need to be rotated on the Y axis but it seems to causing problems with the direction.
If I rotate something on the Z axis, it seems to help with the direction but the rotation is not right, it nor what I want. If I rotate it on the Y axis, it looks right, it looks exactly what I want but in this case the direction of the actor is not right it different from the rotation.

I don't understand what am I doing wrong?
Last edited by ddabrahim on Fri Sep 02, 2016 7:31 pm, edited 2 times in total.
Reason: Automatically merged double post.
Create 2D sprites from 3D models: http://3d2sprite.blogspot.com

User avatar
AnvilHouse
001 Support
 
Joined: Mon Mar 04, 2013 1:19 am
Location: Wisconsin, USA

Re: How to turn the actor and make it move forward?

Postby AnvilHouse » Fri Sep 02, 2016 9:56 pm

Sorry XD i keep forgetting i am using the beta :P

This is what I have in he right pressed, left pressed just triggers the left switch



On release of the key it turns the corresponding switch off.
Image Image Image

https://www.patreon.com/Anvilhouse ...yes...I am on Patreon!


-The store is under construction-
All items are guaranteed to work with 001 ;)

User avatar
ddabrahim
Member
 
Joined: Tue Aug 23, 2016 6:24 pm

Re: How to turn the actor and make it move forward?

Postby ddabrahim » Sat Sep 03, 2016 6:42 am

Hi.
Thanks, but seems like the event you are using is also a beta thing as I don't have the "Change Facing Angle Direction" event in my version and probably it is the reason I was unable to import it. The only thing I have is "Change Facing Cardinal Direction" and "Change Facing Direction Based on Movement".

Anyway, it seems like the main problem I'm facing is that I need to rotate the actor on the Z axis in order to make the direction change too but it doesn't looks right.
I can't described it so I just made a screenshot:

This is how my actor looks like:
no rotation.png
no rotation.png (5.17 KiB) Viewed 953 times

And this is how it looks like when I rotate it on the Z axis:
rotated_on_z_axis.png
rotated_on_z_axis.png (5 KiB) Viewed 953 times

I have tried all the events available for Angle, Aim, Facing, Rotation, Direction but I get the same result with all of them when I rotate my actor on the Z axis.
I guess the solution could be the event you showing me, but it is not available in my version of 001. It is the Steam version by the way.

Is there any solution for the problem I'm having with rotation on Z axis?
Create 2D sprites from 3D models: http://3d2sprite.blogspot.com

User avatar
AnvilHouse
001 Support
 
Joined: Mon Mar 04, 2013 1:19 am
Location: Wisconsin, USA

Re: How to turn the actor and make it move forward?

Postby AnvilHouse » Sat Sep 03, 2016 12:59 pm

Could you provide a screenshot of your sprite editor screen? This would clear up a bunch Im thinking you have something not set that needs to be.

Also, yes the event did change its name...it is now Change Z event in actors. What i have is the rotate graphics with direction checked.

Image

I am horrible at explaining things, sorry for the amount of time this is taking :lol:
Image Image Image

https://www.patreon.com/Anvilhouse ...yes...I am on Patreon!


-The store is under construction-
All items are guaranteed to work with 001 ;)

User avatar
ddabrahim
Member
 
Joined: Tue Aug 23, 2016 6:24 pm

Re: How to turn the actor and make it move forward?

Postby ddabrahim » Sat Sep 03, 2016 2:28 pm

The "Rotate graphics with Direction" is solved the problem. Thanks a lot :)
Create 2D sprites from 3D models: http://3d2sprite.blogspot.com


Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron