Bigbaddevil7

Aka SteamPunkDevil
Member
Joined
Jan 30, 2017
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
So I know Javascript, but my background is entirely different to this. So I am trying to figure out the flow that is going on here.

One thing I am trying to do. Is get the Screen X to eventually be able to draw a sprite over the character. I know this can be done in the Game using variables, but I plan to expand upon this such as including direction and a couple of other things, which to my knowledge isn't really feasible such as drawing a direction sprite depending on where the character is looking and still have it follow.

Now, I'm not asking for working code on how to do that, but really looking for the gap I am missing in how to grab information like that from the current code flow.


I been looking at the:
Code:
Sprite_Character.prototype.updatePosition = function() {
    this.x = this._character.screenX();
    this.y = this._character.screenY();
    this.z = this._character.screenZ();
};
and been trying to reference it
Code:
alias_spriteUpdate = Sprite_Character.prototype.update;
Sprite_Character.prototype.update = function() {
    alias_spriteUpdate.call(this);
    console.log(this._character.screenX());
};
I get readouts but its acting like its still getting just the Pixels and not the screenX.

And looked at:
Code:
Game_CharacterBase.prototype.screenX = function() {
    var tw = $gameMap.tileWidth();
    return Math.round(this.scrolledX() * tw + tw / 2);
};
which is clearly doing the math to offset the scrolling and divide the tiles, but I am still clearing missing how this is all be pulled together.

Hopefully help with this well make me understand the code flow for JS Game Dev more. At the moment all my expertise is all Logic Web based programming, not use to the environment of this.
 

KanaX

Just being a sleepy
Veteran
Joined
Apr 3, 2013
Messages
1,455
Reaction score
1,299
First Language
Broken English.
Primarily Uses
N/A
Why not just draw your sprite over the Sprite_Character bitmap? That way you can utilize all the benefits of the Class.
 

Bigbaddevil7

Aka SteamPunkDevil
Member
Joined
Jan 30, 2017
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
Mainly just cause I'm new to all this so learning all this and didn't even think of that as a possibility. I want to be able to eventually make it where you can pass this to an event as well as be able to have it on a character.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,634
Reaction score
1,452
First Language
French
Primarily Uses
RMMV
for screen
PHP:
 mX = Graphics.pageToCanvasX(event.pageX), mY = Graphics.pageToCanvasY(event.pageY);
dont forget to do a dX*48; if you need reel map (48 are your current tile w,h)
dx are displayX and also displayY
 

Latest Threads

Latest Profile Posts

Last week I was resting and working mainly on the game!
The current progress of the character.
OxWQ7zO.gif

Pre-programmed character :
-Cleaning
-Magic Book(include blood mode)
-Kettle pot stirring
-Other specimens(flower/bug...etc)
I found a huge spider in my house but it has disappeared and now I'm living in fear and paranoia
It's funny, the only reason I haven't actually released a prototype or demo is not that I don't have one. Hahahahahaha I do, I've had a prototype for months. I'm really just concerned with someone taking it, and putting it up on Steam or something first, then saying it's theirs. I should probably look into setting all that up or something... Then again, I have no ETA on the full game so not sure it's worth it yet.
Pixel Grass Sprites, Questing & Fast Traveling w/ Items, Sci-fi & Distorted Music | RPG Maker News #35

Is it me or while modifying RTP style SV Actor sets to make them taller, the idle animation is the hardest to get right? I think it's because that's the one that you see most so seeing pixels that look wrong make you constantly seek to correct that.

Forum statistics

Threads
111,225
Messages
1,059,397
Members
144,490
Latest member
ametan
Top