The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Character that wanders above a certian point

3 posters

Go down

Solved Character that wanders above a certian point

Post by Hax4Ever December 24th 2014, 12:09 am

Okay so this one is just to make the forum im administrating look cool, I want there to be a little pixelated character that wanders around (He cant wander off the edges of a certian point) and uses seperate Images for each animation (GIF file should allow me to animate it)

Character that wanders above a certian point VkIFxah


I am using Phbb2

Here is the website: http://cavestoryroleplay.forumotion.com/

So yeah, I think it would be possible using 4 different images. Two for standing still (Facing left and right) And Two for walking (Facing left and right)


Last edited by Hax4Ever on January 10th 2015, 5:55 pm; edited 1 time in total (Reason for editing : Forgot to put it solved a long time ago :P)
Hax4Ever
Hax4Ever
Forumember

Male Posts : 27
Reputation : 2
Language : English
Location : California

http://cavestoryroleplay.forumotion.com/

Back to top Go down

Solved Re: Character that wanders above a certian point

Post by Ange Tuteur December 24th 2014, 3:32 am

Hello @Hax4Ever,

That's possible. When I'm bored I sometimes end up writing some silly things. I dug this out of some old files.. Laughing

Go to Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In all the pages ( if you want )
Plop this into the codebox :
Code:
$(function() {
  var leftImage = 'http://i59.servimg.com/u/f59/19/05/20/85/spin10.gif',
      rightImage = 'http://i59.servimg.com/u/f59/19/05/20/85/spin10.gif',
      speed = 40,
      
  eliza = document.createElement('IMG'), pos = 'positive', node = document.getElementById('fa_ticker_container');
  eliza.src=rightImage;
  eliza.setAttribute('style','position:relative;left:0%;bottom:0;');
  node.parentNode.insertBefore(eliza,node);
  window.setInterval(function(){
    if (pos === 'positive') {
      eliza.style.left = getLeft() + 1 + '%';
      if (getLeft() >= 97) pos = 'negative', eliza.src = leftImage;
    } else if (pos === 'negative') {
      eliza.style.left = getLeft() - 1 + '%';
      if (getLeft() <= 0) pos = 'positive', eliza.src = rightImage;
    }
  },speed);
  function getLeft() { return Number(eliza.style.left.replace(/%/,'')) }
});

You can change the following :

leftImage : The image displayed when the image is animated to the left
rightImage : The image displayed when the image is animated to the right
speed : How fast the image moves
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Character that wanders above a certian point

Post by Ape January 11th 2015, 11:46 pm

Topic solved and archived


Character that wanders above a certian point Left1212Character that wanders above a certian point Center11Character that wanders above a certian point Right112
Character that wanders above a certian point Ape_b110
Character that wanders above a certian point Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19452
Reputation : 2012
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum