Post new topic    
Slime Knight
Send private message
Set Parent a Slice to a Map Layer 
 PostWed Mar 06, 2013 12:09 pm
Send private message Reply with quote
Hey guys! Quick question, under Slice Functions in the Plotscripting Dictionary it says, and I quote, "You may set parent a slice to a map layer to make it move with the camera just like heros and NPCs do." However, it does not offer an example of the proper syntax to make this happen. I have tried several different ways, but can't seem to get it to work. Something like this:

Code:
spritetops:=createcontainer(320, 200)
setparent(spritetops, sl:maplayer 1)


It's probably easy, and I admit I'm rusty on my plotscripting, but if anyone can help, I'd really appreciate it! Thanks!
Soda Piggy Website
Red Slime
Send private message
 
 PostWed Mar 06, 2013 3:19 pm
Send private message Reply with quote
Well, I don't have my code in front of me, but I believe what you're missing is the "lookup slice" command around your sl:map layer 1. sl:map layer 1 is just an enum of some kind I believe, whereas lookup slice will return a reference to the actual slice object.

Code:

spritetops := createcontainer(320, 200)
set parent(spritetops, lookup slice(sl:map layer1))
Slime Knight
Send private message
 
 PostWed Mar 06, 2013 4:20 pm
Send private message Reply with quote
Much appreciated! Everything works perfectly now. Thanks! Smile
Soda Piggy Website
Liquid Metal King Slime
Send private message
 
 PostWed Mar 06, 2013 4:21 pm
Send private message Reply with quote
sotrain is exactly correct. slice lookup codes cannot be used in place of handles, you have to use the "lookup slice" command to get a slice handle from a slice lookup code
Display posts from previous: