Jump to content

How to extends PIXI.extras.AnimatedSprite?


cpu_sam
 Share

Recommended Posts

how can I extends the AnimatedSprite from pixi 4.8.7?

I'm not able to do this in vscode because it says that the constructor of base class (AnimatedSprite) should be 0 args but got 2. Why this?

Se my code:

import 'pixi.js';

export class Animation extends PIXI.extras.AnimatedSprite
{
	constructor (name:string, textures:PIXI.Texture[], loop:boolean=true)
	{
		super(textures,loop);
		this.name = name;
		this.anchor.set(0.5);
	}
}

I'm using typescript. At the line with the super give error in vscode, and the this.name and anchor it like if not exist.

What should I do?

Link to comment
Share on other sites

Are you sure you've got the correct typings for your pixijs version? In v5 animatedsprite is moved from extras to PIXI namespace, and those typings have only stub class. 

Well, if you dont understand how to fix typings or you cant wait for answer you should use JS. In that case i recommend to clone pixijs repo to your computer because docs can wrong you too.

There's a rumor that certain parts of PixiJS will be moved to typescript this year *insert evil laugh here*.

Link to comment
Share on other sites

Hahaha man, I can't express myself here cause of my limitation with English. But, you are a great person @ivan.popelyshev, I started to follow your work with Pixi some time ago and I see that you have MANY will to help people.

So, apart this. I never will go back to typescript, never in my life I had so close to have a heart attack because of a language. Well, I came from using Phaser 2 with typescript and many problems happened, configure a simple project was hard as hell. C++ is so far easily than typescript and you not wast time configuring vscode. And yes, I configured the Pixi properly like it should be, and even had problems.

I'm using this language for some months and had many, many problems. So to keep my health and sanity, I give up of this lang. I will use javascript... only when I take a piece of cake and drink some coffee at morning.

 

Link to comment
Share on other sites

Russian english here. Thank you! I just had a trip through Sochi, Barselona, Ibiza and Palma visiting major pixijs users and helping them for food :) I'll board plane to Moscow in a hour.

hm, looks like CoffeeScript is the thing that you need ? CakeScript doesnt exist, unfortunately.

TS is good for people who came from Java/C#/ActionScript3. However it adds complexity for all the tools and plugins. I use TS only with namespaces and simple concatenation with "tsc" tool. I copy "ts.d" files into separate dir to know for sure that typings that i use correspond to the version. It really helps if you have like 50k or 1m lines of code.

Yes, you need balance between configs and language. People prefere very difficult configs and tools right now, I'm stick to basics. "references.ts", "tsconfig" and "ts.d" files are analogues to makefile, configure and includes. And webpack is piece of .. js tech.

Link to comment
Share on other sites

+1 for Typescript. Webpack/Rollup are actually pretty easily configurable and versatile module bundlers. The web moves fast and it's about enabling you to use the latest and greatest tech while still supporting outdated targets as painlessly as possible. Large projects written in plain ES5 with file concatenation are usually a nightmare to maintain and work on unless they are beautifully written and documented by skilled and knowledgable people. Code editors don't know anything about the project unless you configure them to and they have complex JS analysis features. Even then it doesn't work particularly well a lot of the time. ES5 JS + namespaces look so dated and a chore to read and write at this point. Some of the Grunt/Gulp configs I've seen and worked on are far from simple too btw.

Link to comment
Share on other sites

5 hours ago, ivan.popelyshev said:

Russian english here. Thank you! I just had a trip through Sochi, Barselona, Ibiza and Palma visiting major pixijs users and helping them for food :) I'll board plane to Moscow in a hour.

hm, looks like CoffeeScript is the thing that you need ? CakeScript doesnt exist, unfortunately.

Hahaha I cryed of laught here.

I will change to javascript and wait not have so many troubles as with typescript.

Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...