Post new topic    
King Slime
Send private message
Scripting With Slices 
 PostSat Mar 17, 2012 2:07 am
Send private message Reply with quote
Personally, I hate working with slices. It's too complicated for my likings. To many brackets and variables causes my brain to malfunction.
However...so many good things can be done with them, so I need help. I knew this would be inevitable.

I'm running an evolution test game demo for my Pokemon Beige. It shall be a rough draft of Evolution. Anyways, I want to display Pokemon slices in the center of the screen...they'll be available as various enemy sprites. Since my alternative is making backdrops for every evolution...

How would I show a slice in the center of the screen, have it change palette to a full black palette, then have it switch back and forth from one slice to another, and then have it become a colored slice of the new Pokemon?

If you want clarity on how that should look, play Puckamon and evolve a Puckamon, or even play ANY Pokemon game.
Liquid Metal King Slime
Send private message
 
 PostSat Mar 17, 2012 4:57 am
Send private message Reply with quote
something like this:

Code:

script, pokemon evolve example, begin
  large pokemon evolve(5, 6)
end

script, large pokemon evolve, sprite 1, sprite 2, begin
  # This script assumes that palette 0 is all black
  variable(sl)
  sl := load large enemy sprite(sprite 1)
  center slice(sl)
  wait(20)
  set sprite palette(sl, 0)
  wait(6)
  variable(i)
  for(i, 0, 10) do(
    replace large enemy sprite(sl, sprite 1, 0)
    wait(2)
    replace large enemy sprite(sl, sprite 2, 0)
    wait(2)
  )
  wait(6)
  set sprite palette(sprite 2)
  wait(20)
  free slice(sl)
end


I haven't tested this, but I am pretty sure it will work. Let me know if it does.
Blubber Bloat
Send private message
 
 PostMon Mar 19, 2012 4:39 pm
Send private message Reply with quote
I've been trying to figure out how to use slices as a method of displaying pages for a bestiary myself...my only real issue is how to close the slice after opening it....
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x V
Liquid Metal King Slime
Send private message
 
 PostMon Mar 19, 2012 6:01 pm
Send private message Reply with quote
Meowskivich wrote:
I've been trying to figure out how to use slices as a method of displaying pages for a bestiary myself...my only real issue is how to close the slice after opening it....


The free slice command will remove any slice you have previously created (or loaded with "load slice collection")

Also, if you are storing your slice handle in a global variable, it is a good habit to zero it after you free the slice:

Code:

sl := load slice collection(0)
# do things with it
free slice(sl)
sl := 0
Blubber Bloat
Send private message
 
 PostTue Mar 20, 2012 12:48 pm
Send private message Reply with quote
ohhhhh, I get it now. I was a little confused when I glanced at this yesterday, but I think I understand how this works now.
Thanks!
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x V
Blubber Bloat
Send private message
 
 PostTue Mar 20, 2012 1:17 pm
Send private message Reply with quote
bonus question!
the hamsterspeak compiler thing object doesn't recognize "sl" as anything, annnnnd being I'm not exactly on first-name basis with hamsterspeak, I really don't know how to set that up....might I ask how? Angel
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x V
Liquid Metal King Slime
Send private message
 
 PostTue Mar 20, 2012 2:07 pm
Send private message Reply with quote
if you just need the variable to exist in the current script, then you do:

Code:
variable(sl)


but if you need it to be shared between all scripts, you do:

Code:
global variable(0, sl)


where 0 is a unique id that can't be the same for any two variables. Also, if it is a global, you might want a more descriptive name. I usually use sl as a name for a local variable, but I give global slice variables more descriptive names like:

Code:
global variable(0, map hp meter sl)
Blubber Bloat
Send private message
 
 PostTue Mar 20, 2012 3:49 pm
Send private message Reply with quote
Poly carp, it works! Thanks a bunch! Now I've got a little more realistic goal for me to work with before I release my game.
Thanks again! Grin
dOn'T MiNd mE! i'M jUsT CoNtAgIoUs!!!
Play Orbs CCG: http://orbsccg.com/r/4r6x V
Display posts from previous: