 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
J_Taylor The Self-Proclaimed King of Ketchup

Joined: 02 Dec 2009 Posts: 188 Location: Western NY
|
Posted: Tue Apr 20, 2010 4:11 am Post subject: Bottom-to-top scroller issues |
|
|
So I'm making a bottom-to-top scroller (think side-scroller on its side), and I'm wondering if there's a way to make the hero stay INSIDE the confines of the camera, cuz right now, he slips off the top and bottom of it.
For visual reference, think space invaders, but scrolling. If that helps at all... _________________ Elemental: .75%
Heart of Darkness: 0% (crash)
The Mansion: .05%
Shattered Alliance: .05%
See a pattern forming? I do, dammit. |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue Apr 20, 2010 4:43 am Post subject: |
|
|
You could have the hero explode the moment he touches the top and bottom of the screen. |
|
Back to top |
|
 |
NeoSpade Of course!

Joined: 23 Sep 2008 Posts: 249 Location: Wales GB
|
Posted: Tue Apr 20, 2010 5:29 am Post subject: |
|
|
There's a simple way to do this, but it means making the hero stay inside a box of walls.
Now lets say your view looks like this:
Code: |
wwwwwwwwwww
w#########w
w#########w
w####@####w
w#########w
w#########w
wwwwwwwwwww
@ = Hero
# = Floor
w = Wall
|
We'll do this:
Code: |
###########
###########
###########
###########
wwwwwwwwwww
w#########w
w#########w
w####@####w
w#########w
w#########w
wwwwwwwwwww
###########
###########
###########
|
Right, in the map auto-run script have something like this:
Code: |
plotscript,fake_scroll-up,begin
suspend NPC walls
put camera (X*20,Y*20) #where X and Y are, replace those with the center of the view
end
|
The hero won't be able to leave the view, and enemies can spawn off screen at the top, and vanish off screen at the bottom. (you're gonna have to do that bit, or else you might have to credit me :p)
Oh and as for the illusion of scrolling, have a bunch of NPCs that have randomly assigned graphics appear 1 tile above the view, and then have them destroyed when they reach the tile below the view.
Code: |
#add this to the script above
create NPC (id,X,Y,random)#use direction to determine its image
walk NPC (id,down,big number here)
wait for NPC
#repeat this command for as many background elements as you need
|
then have a new script that does this
Code: |
plotscript,remove_NPC, begin
if (NPC at spot (X,Y,id))
then (destroy NPC (id)
create NPC (id,X,Y,random)
walk NPC (id,down,big number)
wait for NPC (id))
#same as before, rinse and repeat for as many map elements you need
end
|
That will have to go in the step command on the map (and might have to go in a while loop, which I don't know how to use :S) Make sure that these NPCs do nothing, and are step-on NPCs.
Well, I hope that (probably awefully scripted example) helps, if I got it wrong, anyone can feel free to correct me.
*disclaimer; I've not tested these, so this may not work/may be incorrect*
EDIT:
Thought of a better way to do the scrolling stars:
Code: |
#add this to the script above
create NPC (id,X,Y)#use direction to determine its image
run script by ID (@tiletype)
walk NPC (id,down,big number here)
wait for NPC
#repeat this command for as many background elements as you need
|
Code: |
script, tiletype, begin
variable (tilepicture)
tilepicture := random (1,2)#can be any range
if (tilepicture == 1)
then (alter NPC (id,NPCstat:picture,picture number))
if (tilepicture == 2)
then (alter NPC (id,NPCstat:picture,picture number))
#etc
else
end
|
Code: |
plotscript,remove_NPC, begin
if (NPC at spot (X,Y,id))
then (destroy NPC (id)
create NPC (id,X,Y)
run script by ID (@tiletype)
walk NPC (id,down,big number)
wait for NPC (id))
#same as before, rinse and repeat for as many map elements you need
end
|
|
|
Back to top |
|
 |
J_Taylor The Self-Proclaimed King of Ketchup

Joined: 02 Dec 2009 Posts: 188 Location: Western NY
|
Posted: Tue Apr 20, 2010 7:35 am Post subject: |
|
|
... good tips, but not sure how to incorporate.
See, I took the script that (Moogle1?) wrote on side-scrollers, and adapted that to make a scroller from bottom-to-top, with allowing the hero to move freely.
I understand how to have the NPCs appear and disappear. I can incorporate that semi-easily. But what about the rest? Does this mean I have to see if I can figure out how to set walls to the north and south? And my map's not gonna look the same now either, right?
Hope you guys can put up with this. I just got into scripting, and I think I'm jumping in too deep too fast.  _________________ Elemental: .75%
Heart of Darkness: 0% (crash)
The Mansion: .05%
Shattered Alliance: .05%
See a pattern forming? I do, dammit. |
|
Back to top |
|
 |
Nepenthe

Joined: 27 Sep 2004 Posts: 132
|
Posted: Wed Apr 21, 2010 5:09 pm Post subject: |
|
|
I would think the easiest way to do this is with a screen-sized slice. Simply check the hero's position against the edges of the slice and reposition the hero as necessary to keep it in-bounds.
If you don't want to use a slice, you could store the camera's Y postion (I think there's a command for this, can't check the dictionary right now) and check the hero's Y against that. Just make sure the hero stays within about 100 pixels north or south of the camera (allowing for the size of the hero sprite).
You could alter the passblock (I.e. Walltiles) at the edges of the screen, but if the screen scrolls automatically you'll need to move the hero anyway, which would make the walls redundant.
Side note: Have you played Tyrian? One of the best top-scrollers of all time. |
|
Back to top |
|
 |
J_Taylor The Self-Proclaimed King of Ketchup

Joined: 02 Dec 2009 Posts: 188 Location: Western NY
|
Posted: Thu Apr 22, 2010 3:06 pm Post subject: |
|
|
Wow. Will try those suggestions. Maybe I'll force myself to actually learn how to use sprites.
As for Tyrian, no I haven't. I'm assuming it isn't an OHR game... _________________ Elemental: .75%
Heart of Darkness: 0% (crash)
The Mansion: .05%
Shattered Alliance: .05%
See a pattern forming? I do, dammit. |
|
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
|