 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sun Feb 07, 2010 11:03 am Post subject: |
|
|
if(giant) is a shorter way of saying if(giant <> 0)
It is just a way of making sure that you don't try to manipulate the slice before it has been created or after it is destroyed.
You could make several different slices, it would work, but I think it would be more complicated. I think the "Replace large enemy sprite" is better. Then you only need one slice. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue Feb 09, 2010 7:14 pm Post subject: |
|
|
Try this...
Code: |
script, update giant NPC, begin
variable(sl, x, y)
if(current map <> map:Abrahassax Plains) then(
free slice(giant)
giant := 0
stop timer(1)
exit script
)
if(giant) then(
sl := giant
set slice x(sl, NPC pixel x(97))
set slice y(sl, NPC pixel y(97))
variable(dir)
dir := NPC direction(97)
variable(frame)
frame := NPC frame(97)
switch(dir) do(
case(up) do(Replace large enemy sprite(sl,15+frame))
case(right) do(Replace large enemy sprite(sl,19+frame))
case(down) do(Replace large enemy sprite(sl,13+frame))
case(left) do(Replace large enemy sprite(sl,17+frame))
)
set timer(1, 0, 1, @update giant NPC)
)
end
|
Let me know how it works |
|
Back to top |
|
 |
BlastedEarth

Joined: 05 Oct 2009 Posts: 243
|
Posted: Tue Feb 09, 2010 11:14 pm Post subject: |
|
|
Hahahahahaha, thanks, you are like the ragnarok in ff6! you turn the tedium into treats  _________________ So many ideas, so little focus. Monk spirit please lend me your power!
 |
|
Back to top |
|
 |
Guest
|
Posted: Wed Feb 10, 2010 5:07 pm Post subject: |
|
|
Yeesh, that looks way more elegant than what I did. Oh well, might as well put it up anyway.
Problem is, the big sprite blips out (as far as I can tell) when it wraps around the map, even using the nightly.
Code: |
global variable (1,giant)
global variable (2,framecount)
global variable (3,framedelay)
#-----------------------------------------------
plotscript, setup giant NPC, begin
variable(sl)
framecount:=1
framedelay:=0
sl := load large enemy sprite(2,2)
#--In this case, the layer called is a blank one above the player and NPC layers.
set parent(sl, lookup slice(sl:map layer 2))
set horiz anchor(sl, edge:center)
set vert anchor(sl, edge:middle)
giant := sl
update giant NPC
end
#-----------------------------------------------
script, update giant NPC, begin
variable(sl, x, y)
if(current map <> map:World Map) then(
free slice(giant)
giant := 0
stop timer(1)
exit script
)
if(giant) then(
sl := giant
)
#--calls script below
giantdirection
#--Positions big sprite over the center of NPC/vehicle. (NPC 0 here).
set slice x(sl, (NPC pixel X(0)+10))
set slice y(sl, (NPC pixel y(0)+10))
set timer(1, 0, 1, @update giant NPC)
end
#-----------------------------------------------
#--Script counts 1,2,1,2,etc. and returns the result.
#--Used to control what frame is displayed for whatever direction.
script, framecheck, begin
if (framecount==1)
then(
framecount:=2
return (framecount)
)
else
(
framecount:=1
return (framecount)
)
end
#-----------------------------------------------
#--Requires a tag which asks, is the hero in a vehicle? In this case it's tag 2.
#--Matches the big sprite direction to the player,
#--and cycles the big sprite in a two frame animation.
#--It's assumed that the big sprites are ordered north1, north2,
#--east1, east2, south1, south2, west1, west2 directionwise.
script, giantdirection, begin
variable(sl, x, y)
sl := giant
#--is in a vehicle? 1=yes
if(check tag (2))
then(
#--Big sprite doesn't animate if player isn't moving.
if (hero is walking (leader))
then(
#--Slows down the the animation frequency a bit, it's really fast without this.
if (framedelay==1)
then(
framedelay:=0
switch(hero direction (leader)) do, begin
case(north) do, begin
switch(framecheck) do, begin
case(1) do, begin
replace large enemy sprite (sl, 0, 1)
end
case(2) do, begin
replace large enemy sprite (sl, 1, 1)
end
end
end
case(east) do, begin
switch(framecheck) do, begin
case(1) do, begin
replace large enemy sprite (sl, 2, 2)
end
case(2) do, begin
replace large enemy sprite (sl, 3, 2)
end
end
end
case(south) do, begin
switch(framecheck) do, begin
case(1) do, begin
replace large enemy sprite (sl, 4, 2)
end
case(2) do, begin
replace large enemy sprite (sl, 5, 2)
end
end
end
case(west) do, begin
switch(framecheck) do, begin
case(1) do, begin
replace large enemy sprite (sl, 6, 2)
end
case(2) do, begin
replace large enemy sprite (sl, 7, 2)
end
end
end
end
)
else
(increment (framedelay))
)
)
end
|
|
|
Back to top |
|
 |
mjkrzak

Joined: 24 Nov 2009 Posts: 43
|
Posted: Wed Feb 10, 2010 5:12 pm Post subject: |
|
|
Man, am I forgetful today. Not only did I post that mess above without logging in, but I forgot my secondary goal.
You might want to consider adding a frame or two to that big walker thing. There's nothing stopping you since the animation isn't constrained to two frames, and it would look a lot smoother considering the size of the transport. |
|
Back to top |
|
 |
BlastedEarth

Joined: 05 Oct 2009 Posts: 243
|
Posted: Thu Feb 11, 2010 3:18 am Post subject: |
|
|
Ah i can't wait to try this out! _________________ So many ideas, so little focus. Monk spirit please lend me your power!
 |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|