MovePicture around Valur (Math.PI)

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
Ok guys, am trying make rotation of planet.


if the sunny ex:


If my Var Center=200;


how move other picture around this VAR Center?


In a parallel process


var radians = (Math.PI / 180) * Center;


Code:
$gameScreen.movePicture(1, 1, $gameMap.event(6)._x+radians, $gameMap.event(6)._y+radians, 40, 40, 255, 0, 240);
Code:
wait 3sec;





if someone has an idea from concept to move an image around a variable valur. ?


Is possible ?
I am confident that I am take hurts
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
You'd want want to set the position based on the center, which you don't even use in your example.


// setup in some function
this.center = {x: 200, y: 200};
this.radius = 50; // How far away from the center will it be rotating around?
this.angle = 0;

.
.
.
.

// Some update function
var x = this.center.x + Math.cos(angle) * radius;
var y = this.center.y + Math.sin(angle) * radius;
angle += 0.1; // Adjust this to change the speed of the rotation
$gameScreen.movePicture(1, 1, x, y, 40, 40, 255, 0, 240);


This requires that you have a setup function and an update function, but it'll move your picture around the center point and keep it radius distance away from the actual point so that it looks like it's actually rotating around that position.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
You'd want want to set the position based on the center, which you don't even use in your example.



// setup in some function
this.center = {x: 200, y: 200};
this.radius = 50; // How far away from the center will it be rotating around?
this.angle = 0;

.
.
.
.

// Some update function
var x = this.center.x + Math.cos(angle) * radius;
var y = this.center.y + Math.sin(angle) * radius;
angle += 0.1; // Adjust this to change the speed of the rotation
$gameScreen.movePicture(1, 1, x, y, 40, 40, 255, 0, 240);


This requires that you have a setup function and an update function, but it'll move your picture around the center point and keep it radius distance away from the actual point so that it looks like it's actually rotating around that position.
ok tanks my friend , i will study this 
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top