Drawing a colour to a pixel (or multiple pixels)

nathanlink169

Game Dev by Career, no idea what I'm doing
Veteran
Joined
Aug 15, 2013
Messages
59
Reaction score
22
First Language
English
Primarily Uses
RMMV
Hi all.

I'm trying to highlight an area with a semi-transparent colour to represent an NPC's vision cone. Is there a way to say "draw this colour at this location"?
 

Ace of Spades

Veteran
Veteran
Joined
Jan 19, 2017
Messages
103
Reaction score
133
First Language
English
Primarily Uses
Not sure if you're just needing the visual part of the vision cone showing, but if that's the case why not just use the show picture command in editor? You can set the coordinates to variables, set the opacity, and it'll give you more creative control on how it should look (for example if you want a gradient in the vision cone)
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
489
Reaction score
190
First Language
thai
Primarily Uses
RMMV
this plugin process the visual sensor
but… if you want to write your own code
you need to dig in by yourself
because I’m not do it yet…
 

nathanlink169

Game Dev by Career, no idea what I'm doing
Veteran
Joined
Aug 15, 2013
Messages
59
Reaction score
22
First Language
English
Primarily Uses
RMMV
Not sure if you're just needing the visual part of the vision cone showing, but if that's the case why not just use the show picture command in editor? You can set the coordinates to variables, set the opacity, and it'll give you more creative control on how it should look (for example if you want a gradient in the vision cone)
Thank you for the suggestion! I did consider this at first, but I ran into a few theoretical issues. I'm using a pixel-based movement in my game, rather than tile-based, so ensuring that the image is pixel-perfect to the math that's happening will be a slight pain. Another issue is that if the vision gets blocked by the terrain, I want to be able to reflect that. I'm not certain that's possible with an image. Lastly, I think this is a good learning opportunity.

this plugin process the visual sensor
but… if you want to write your own code
you need to dig in by yourself
because I’m not do it yet…
Thanks for the resource! I'll take a look at how they're doing the drawing. I definitely want to write my own code for this, primarily to learn. I've done vision cones in other languages and they're not terribly difficult to do, I'm just unfamiliar with the RPG Maker library exactly.
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
489
Reaction score
190
First Language
thai
Primarily Uses
RMMV
and this is japanese version where the dev still actively improving it

by myself the English plugin is in alien language haha...
he use something beyond my knowledge
I only understand something more base rpg maker mv editing...
and my mathematic skill is poor...haha...
the japanese one use bitmap function that I guess is the one
had no time to experiment on it yet
 

nathanlink169

Game Dev by Career, no idea what I'm doing
Veteran
Joined
Aug 15, 2013
Messages
59
Reaction score
22
First Language
English
Primarily Uses
RMMV
I was able to figure out the answer to my question. MV uses PIXI.js as its graphics manager. The following code will draw a box on screen:

JavaScript:
// Call this code on initialization
this._sprite = new PIXI.Graphics();
SceneManager._scene.addChild(this._sprite);

// Call this code any time you want to change what is displayed
this._sprite.clear();
this._sprite.beginFill(0xFF0000, 0.5);
this._sprite.drawRect(50, 200, 100, 75);
this._sprite.endFill();
 

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

Latest Threads

Latest Profile Posts

Playtesting for Battle Castle is done, demo time for me was roughly 6 hours and 20 minutes. I'm going to pass it on to a few friends first, and after getting some feedback will be posting an official topic.
There's another Humble Bundle available now for RPG developer assets, this time focused somewhat more towards pixel art style games.
Ive got a long lost half uncle. Thats real cool.
I forget what is bumping rule in this forum. Is anyone know? Thank you.
BCj
Ew, why does my blogpost on the rpgmaker.net site look like a garbled mess? Are html codes disabled or something?

Forum statistics

Threads
97,909
Messages
947,782
Members
129,148
Latest member
lemminace
Top