Comunidad de diseño web y desarrollo en internet online

publicar variable en twit

Citar            
MensajeEscrito el 11 Abr 2012 02:06 pm
Hola,

estoy haciendo un juego que tiene score y deseo que este score se muestre a la hora de twittear.

este es el codigo HTML que estoy usando para hacer el llamado

Código HTML :

<a id="twit" href="https://twitter.com/share" class="twitter-share-button" data-url="http://link.com" data-text="Obtuve muchos puntos : # " data-lang="es" data-size="large" data-related="loquesea" data-count="vertical" data-hashtags="loquesea">Twittear</a>
    
     <script type="text/javascript">
    var maxscore = /* aqui sería poner el llamado del score */;
    var elem = document.getElementById("twit");
    elem.setAttribute("data-text", elem.getAttribute("data-text") + maxscore);
  </script>
    
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>


en el juego el codigo que muestra el score total es este

Código Javascript :

this.gameLevel.chainrxn.totalScoreEl.set("text",this.gameLevel.score+this.gameLevel.chainrxn.score);


no he sido capaz de colocar el llamado para que me publique el resultado,

agradezco su colaboración con este detalle

ED

Por edmestizo

1 de clabLevel



 

chrome
Citar            
MensajeEscrito el 12 Abr 2012 09:26 pm
¿Podrías mostrar mas del código de juego?

Por jonasanx

Claber

187 de clabLevel

2 tutoriales

Genero:Masculino  

Entusiasta del Desarrollo Web y Anime fan.

chrome
Citar            
MensajeEscrito el 13 Abr 2012 02:34 pm
miralo aqui, te agradesco tu interes

Código Javascript :

var chainrxn=false;
Ball=new Class({number:0,xposition:0,yposition:0,downspeed:0,rightspeed:0,radius:0,expanding:0,sizeChangeCount:0,disabled:false,expanded:false,chainlevel:0,initialize:function(gameLevel,number,xposition,yposition){this.number=number;
this.gameLevel=gameLevel;
this.radius=this.gameLevel.ballSize;
if(xposition==null){this.xposition=(this.gameLevel.xmax-2*this.gameLevel.ballSize)*Math.random()+this.gameLevel.ballSize;
this.yposition=(this.gameLevel.ymax-2*this.gameLevel.ballSize)*Math.random()+this.gameLevel.ballSize;
var direction=Math.random()*360;
this.downspeed=Math.cos(direction)*this.gameLevel.ballSpeed;
this.rightspeed=Math.sin(direction)*this.gameLevel.ballSpeed;
this.color="#1b2d02"}else{this.xposition=xposition;
this.yposition=yposition;
this.color="#1b2d02";
this.startExpansion();
}
 

this.gameLevel.movingBalls.push(this);
this.draw();
},move:function(){this.xposition+=this.rightspeed;
this.yposition+=this.downspeed;
this.draw();
var notHit=true;
this.gameLevel.expandedBalls.each(function(expandedBall){if(notHit&&this.gameLevel.movingBalls[expandedBall].expanded==true&&Math.sqrt(Math.pow(this.gameLevel.movingBalls[expandedBall].xposition-this.xposition,2)+Math.pow(this.gameLevel.movingBalls[expandedBall].yposition-this.yposition,2))<=this.radius+this.gameLevel.movingBalls[expandedBall].radius){this.chainlevel=this.gameLevel.movingBalls[expandedBall].chainlevel+0;
this.startExpansion();
notHit=false;
}}.bind(this))
if(notHit){if(this.xposition<=this.gameLevel.ballSize||this.xposition>=this.gameLevel.xmax-this.gameLevel.ballSize){this.rightspeed=-1*this.rightspeed;
}
if(this.yposition<=this.gameLevel.ballSize||this.yposition>=this.gameLevel.ymax-this.gameLevel.ballSize){this.downspeed=-1*this.downspeed;
}}},startExpansion:function(){this.expanded=true;
this.gameLevel.expandedBalls.push(this.number);
this.gameLevel.totalBallsExpanded++;
var newPoints=1;
this.gameLevel.score+=newPoints;
this.gameLevel.chainrxn.levelScoreEl.set("text",this.gameLevel.score);
this.gameLevel.chainrxn.totalScoreEl.set("text",this.gameLevel.score+this.gameLevel.chainrxn.score);

this.downspeed=0;
this.rightspeed=0;
this.expanding=1;
if(this.gameLevel.totalBallsExpanded>=this.gameLevel.ballWinCount&&document.body.getStyle("background")!="#fff"){this.gameLevel.showWinBG();
}
(function(){this.expanding=-1;
this.sizeChangeCount=this.gameLevel.shrinkingIntervals;
}).bind(this).delay(this.gameLevel.expandedLifeLength);
if(this.number==this.gameLevel.numBalls){return;
}

Por edmestizo

1 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.