Tinting BitmapText characters separately not working after setting anchor

Đang mở
#253 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
frontend, game-dev

Hướng nghiên cứu

Start by reproducing the issue with the supplied example and compare the two BitmapText instances in Phaser 2.8.0: only the second sets an anchor before tinting its characters. Trace how BitmapText applies its own tint to child characters when the anchor changes. Done means per character tints remain visible after setting the anchor; the payload names no source files or tests.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

help wanted

Basically what in the title is. You can tint a BitmapText's characters separately, but if you set anchor (or maybe some other properties too), the tinting is not working on per character. I guess the engine overwrites all the children elements (the characters) tint values with the BitmapText's tint value.

Here is a small example demonstrating the problem:
http://icedevel.com/phaser-bug/character-tinting/index.html

My opinion is that the children elements should retain tint values if the BitmapText's tint value is not modified.

And the code:

var game;

function preload() {
	this.game.load.bitmapFont("font", "font_simple.png", "font_simple.fnt");
}

function create() {
	var txt1 = this.game.add.bitmapText(50, 50, "font", "012345", 28);
	txt1.children[0].tint = 0xFF0000;
	txt1.children[1].tint = 0xFFFF00;
	txt1.children[2].tint = 0xFF00FF;
	txt1.children[3].tint = 0x0000FF;
	txt1.children[4].tint = 0x00FFFF;
	txt1.children[5].tint = 0xFF0FF0;
	
	
	var txt2 = this.game.add.bitmapText(50, 250, "font", "012345", 28);
	txt2.anchor.setTo(0, 1);
	txt2.children[0].tint = 0xFF0000;
	txt2.children[1].tint = 0xFFFF00;
	txt2.children[2].tint = 0xFF00FF;
	txt2.children[3].tint = 0x0000FF;
	txt2.children[4].tint = 0x00FFFF;
	txt2.children[5].tint = 0xFF0FF0;
	
	
}

function update() {
}


window.onload = function(){
	var config = {
		width: 800,
		height: 600,
		renderer: Phaser.AUTO,
		antialias: true,
		state: {
			preload: preload,
			create: create,
			update: update
		}
	}
	game = new Phaser.Game(config);
};

Tested it on Phaser 2.8.0

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
485
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phaserjs/phaser-ce

Tất cả issue của phaserjs/phaser-ce

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.