Post new topic    
Liquid Metal Slime
Send private message
Anchoring a sprite to hero? 
 PostWed Jan 05, 2011 6:57 pm
Send private message Reply with quote
I tried to just load a sprite and set its coordinates to be equal to that of the hero.

This would work fine for a few steps, but the sprite would start moving farther and farther away from the hero location and eventually run off the screen.

I tried using the other variants of set slice x, but they all resulted in the same outcome.

Any suggestions for how one would pull this off?
Liquid Metal King Slime
Send private message
 
 PostWed Jan 05, 2011 8:18 pm
Send private message Reply with quote
I'd really have to see the script to help you out. but it seems like you made a math error somewhere. Put a negative were a positive should be or something. Or you're using Herox instead of heroPIXELx, but I guess that would be alot farther off then you're describing.

Oh, btw. Where've you been?
Liquid Metal Slime
Send private message
 
 PostWed Jan 05, 2011 8:33 pm
Send private message Reply with quote
Well, what I've tried so far is to have a loop containing directional inputs that will shift the hero in the direction of the arrow key by some variable Hero Speed (4). Looking like:

Code:

if(key is pressed (key:up))
then(
set hero direction (me, up)
put hero (me, hero pixel X (me), hero pixel Y (me) -- Hero Speed)
)


Then later into the loop, I've got:

Code:

put slice (Leader Sprite, hero pixel x (me), hero pixel y (me))


Near the top left corner of the map, it works just fine.
But once it leaves that 320x200 area, it just gets wonky.
I'm guessing there's some screen alignment shenanigans going on and I'll be needing some way to compensate for this.

Quote:
Oh, btw. Where've you been?

busy
Liquid Metal Slime
Send private message
 
 PostWed Jan 05, 2011 8:42 pm
Send private message Reply with quote
When the camera is focused on a 16x10 tile area, the script works fine.

At this point, I'm either thinking of using a zelda-esque screen shifter or just getting rid of hero/npcs altogether.

Zelda-esque seems more appealing right now.
Reigning Smash Champion
Send private message
 
 PostWed Jan 05, 2011 8:54 pm
Send private message Reply with quote
You need to set the sprites to one of the map layers for the x/y positions to be based on map and not the screen.

set parent (yourslice, lookup slice(sl:map layer#))

Where # is 0-7
<TheGiz> oh hai doggy, oh no that's the straw that broke tjhe came baclsb
Liquid Metal Slime
Send private message
 
 PostWed Jan 05, 2011 9:10 pm
Send private message Reply with quote
That did it, thanks!
Display posts from previous: