name: items
defaults:
- symbol: tanks/thing/item.Item
+ symbol: tanks/item/item.Item
desc: ''
# projectile: 'normal'
passives: []
art:
map_icon: '/img/items/rockets-bg-25x25.png'
inv_icon: '/img/items/rockets-50x50.png'
+ shield_gen:
+ name: Shield Generator
+ desc: 'Generates four rotating shield spheres, each of which absorbs one impact.'
+ tags: [ 'armor' ]
+ symbol: tanks/item/shieldgen.ShieldGenerator
+
align: 2
loc: [775,325]
items:
- # - type: rockets # right next to start
- # loc: [325,475]
+ - type: shield_gen # right next to start
+ loc: [325,475]
- type: rockets
loc: [75,275]
- type: nitro
types:
rich:
items:
+ - 0.2 shield_gen
- 0.1 super_armor
- - 0.2 rockets
- 0.3 nitro
+ - 0.1 rockets
'fx' : require('tanks/fx'),
'mixins' : require('tanks/mixins'),
'inventory' : require('tanks/inventory'),
+ 'item' : require('tanks/item'),
'map' : require('tanks/map'),
'thing' : require('tanks/thing'),
'ui' : require('tanks/ui'),
, evt = require('evt')
-, Item = require('tanks/thing/item').Item
+, Item = require('tanks/item/item').Item
, Container = require('tanks/inventory/container').Container
, ContainerUI = require('tanks/ui/containerui').ContainerUI
,
, Container = container.Container
, ContainerItem = container.ContainerItem
, ContainerMeta = container.ContainerMeta
-, Item = require('tanks/thing/item').Item
+, Item = require('tanks/item/item').Item
, Bag = require('tanks/inventory/bag').Bag
, BagBag = require('tanks/inventory/bagbag').BagBag
, EquipSlot = require('tanks/inventory/equipslot').EquipSlot
var Y = require('Y').Y
, evt = require('evt')
, Speciated = require('ezl/mixins/speciated').Speciated
-, Item = require('tanks/thing/item').Item
+, Item = require('tanks/item/item').Item
,
/**
--- /dev/null
+var Y = require('Y').Y
+, item = require('tanks/item/item')
+, sg = require('tanks/item/shieldgen')
+;
+Y.core.extend(exports, {
+ 'Item' : item.Item,
+ 'ShieldGenerator' : sg.ShieldGenerator
+});
--- /dev/null
+var Y = require('Y').Y
+, Rect = require('ezl/shape').Rect
+, Circle = require('ezl/shape').Circle
+, HtmlLayer = require('ezl/layer/html').HtmlLayer
+
+, Item = require('tanks/item/item').Item
+, Shield = require('tanks/thing/shield').Shield
+
+, SQRT_TWO = Math.sqrt(2)
+, TWO_PI = 2 * Math.PI
+,
+
+ShieldGenerator =
+exports['ShieldGenerator'] =
+Item.subclass('ShieldGenerator', {
+ colors: {
+ bg : '#FF6458',
+ body : '#0A9CFF',
+ shine : '#195FBC'
+ },
+
+ spheres: 4,
+
+
+ init : function initShieldGenerator(){
+ Item.init.call(this);
+ this.colors = Y.extend({}, this.colors);
+
+ },
+
+ onAcquired : function onAcquired(evt, container){
+ Item.fn.onAcquired.call(this, evt, container);
+
+ for (var i=0, di = 1/this.spheres; i<1; i += di) {
+ // Component.init will add it to the owner's bookkeeping
+ Shield.create('shield', this.owner, i * TWO_PI);
+ }
+ },
+
+ render : function render(parent){
+ this.remove();
+ var loc = this.loc
+ , icon = (this.art||{}).map_icon
+ , d = this.width, r = d * 0.4
+ ;
+
+ if ( icon )
+ this.shape = new HtmlLayer(null, null, '<img src="'+icon+'"/>')
+ .size(this.width, this.height);
+ else {
+ this.shape = new Rect(this.width, this.height)
+ .fill(this.colors.bg)
+ // .stroke('#1C625B', 5.0)
+ ;
+
+ this.body = new Circle(r)
+ .appendTo( this.shape )
+ .origin('50%', '50%')
+ // .position(0, 0)
+ .position('50%', '50%')
+ .fill(this.colors.body)
+ ;
+
+ // this.shine = new Circle(r)
+ // .position(r,r)
+ // .fill(this.colors.shine)
+ // .eraseCircle(r*0.2,-r*1.5, 1.1*d*SQRT_TWO)
+ // .appendTo( this.body );
+ }
+
+ this.shape
+ .origin('50%', '50%')
+ .position(loc.x, loc.y)
+ .appendTo( parent );
+ this.shape.layer.attr('title', ''+loc);
+
+ return this;
+ }
+
+})
+;
, Map = require('tanks/map/pathing/map').Map
, Thing = require('tanks/thing/thing').Thing
, Tank = require('tanks/thing/tank').Tank
-, Item = require('tanks/thing/item').Item
+, Item = require('tanks/item/item').Item
, Player = require('tanks/thing/player').Player
, Wall = require('tanks/map/wall').Wall
,
, deepcopy = require('Y/types/object').deepcopy
, Mixin = require('evt').Mixin
-, Item = require('tanks/thing/item').Item
+, Item = require('tanks/item/item').Item
, kNull = op.K(null)
,
var Y = require('Y').Y
, bullet = require('tanks/thing/bullet')
, component = require('tanks/thing/component')
-, item = require('tanks/thing/item')
, player = require('tanks/thing/player')
, shield = require('tanks/thing/shield')
, tank = require('tanks/thing/tank')
Y.core.extend(exports, {
'Bullet' : bullet.Bullet,
'Component' : component.Component,
- 'Item' : item.Item,
'Player' : player.Player,
'Shield' : shield.Shield,
'Tank' : tank.Tank,
, Tank = require('tanks/thing/tank').Tank
, Inventory = require('tanks/inventory/inventory').Inventory
, Inventoried = require('tanks/mixins/inventoried').Inventoried
-, Shield = require('tanks/thing/shield').Shield
,
$('#viewport')
.bind('mousedown', this.mousedown)
.bind('mouseup', this.mouseup);
-
- var self = this;
- this.game.on('ready', function(){
- for (var i=0; i<1; i += 0.25) {
- // Component.init will add it to the owner's bookkeeping
- Shield.create('shield', self, i * 2*Math.PI);
- }
- });
},
destroy : function destroy(){
return Tank.fn.destroy.call(this);
},
- setReplay : function setReplay(replay){
- this.replayMode = true;
- this.replay = replay
- this.nextMove = replay.shift();
- },
-
activeKeys : null,
shift : false, ctrl : false, meta : false, alt : false,
leftMouse : false, middleMouse : false, rightMouse : false,
this.shine = new Circle(r)
.position(r,r)
.fill(this.colors.shine)
- // .eraseCircle(-r,-r, d*SQRT_TWO)
.eraseCircle(r*0.2,-r*1.5, 1.1*d*SQRT_TWO)
.appendTo( this.shape );
+
return this;
}
})