The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Character that wanders above a certian point

View previous topic View next topic Go down

Solved Character that wanders above a certian point

Post by Hax4Ever on 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)




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
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 on 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
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Character that wanders above a certian point

Post by APE on January 11th 2015, 11:46 pm

Topic solved and archived





APE
Manager
Manager

Male Posts : 8319
Reputation : 716
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

View previous topic View next topic Back to top


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