 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
The Drizzle Who is the Drizzle?

Joined: 12 Nov 2003 Posts: 432
|
Posted: Wed Feb 04, 2009 3:25 pm Post subject: Large vehicles... |
|
|
I'd like to create a vehicle that is much larger than a single tile and I was wondering if anyone could give me an idea of how to accomplish this. It would likely be at least 2x2 npcs in size. It would really only be traveling down roads and wouldn't encounter many npcs. I don't have many ideas beyond this, but I am curious to see if it is possible, if it is reasonable, and if anyone has any ideas how to accomplish this. Could it be done with slices somehow? _________________ My name is...
The shake-zula, the mic rulah, the old schoola, you wanna trip? I'll bring it to yah... |
|
Back to top |
|
 |
Spoon Weaver

Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Wed Feb 04, 2009 7:32 pm Post subject: |
|
|
well making an npc, or in this case a vehicle, with slices is kinda hard really. Because slices are placed, not on the map, but on the screen. Meaning they don't react well when placed off screen to be found later. However, what you could do is make a couple npcs that when all placed together looked like the vehicle(and are in fact the vehicle), then once you got in one of the npcs a script runs, getting rid of the other npcs and placing a sprite over the hero. Since the hero is always in the middle of the screen, the fact that the vehicle doesn't really move won't matter. However, you'd have to look out for cropped maps. Also, any npcs or walls would be overlapped by the vehicle, but you say you won't be running into any npcs so thats fine, and you can just double up on the width of the wall to give the illusion of the wall stopping the vehicle correctly. You'd also have to have a dismount script that removes the sprite/slice and replaces it with the dummy npcs.
I'd like to point out my knowledge of slices/sprite placement is still fairly limited, since it's a fairly new thing. But I at least think this is how things work. |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Wed Feb 04, 2009 8:28 pm Post subject: |
|
|
There has been some discussion on attaching slices to NPCs, and thus to vehicles as well. If this happens, your problems are solved.
Unfortunately, I cannot help much more, as I do not yet understand slices myself (I have not given them any serious thought as of yet). _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
Back to top |
|
 |
Pepsi Ranger Reality TV Host

Joined: 05 Feb 2003 Posts: 493 Location: South Florida
|
Posted: Wed Feb 04, 2009 10:02 pm Post subject: |
|
|
You're probably better off waiting until the slice tree is complete. But if you can't wait that long--
This is probably the hacky way to do it, but it should be functional:
Create a vehicle that calls a script upon entering and one upon exiting. (I'm not gonna explain how; I'm sure you're smart enough to play around with this feature.)
Have the entering script swap the true vehicle (and the hero) out of the scene and replace it with two NPCs or maptiles (yes, maptiles) that pass as your vehicle.
Make sure you initiate a "key is pressed" wait loop that behaves like normal functionality (or create a custom one if you can't get the arrows to work for you).
Then make sure each NPC moves in the direction that corresponds with the "key is pressed."
You'll want to beef the script up with error checking to make sure the back half is still in sync with the right half by using x/y variable checks (though you might find even greater functionality by checking that the backside is exactly 20 pixels west of the main sprite if the car is facing east, 20 to the south if it's facing north, etc).
Using the "key is pressed" will also give you license to implement collision techniques like sliding and skidding to a halt if you're clever enough with it.
You'll want "Enter" or "Space" to be your loop breakers so you can jump straight to the exit script.
The exiting script should call the true vehicle and the hero back to the current position and return everything to normal.
You'll want to experiment with the positioning of "dismount vehicle," whether you use it in the loop breaker or the exit script. But in the end, the hardest part about this script should be in the smooth transitioning of directions.
(Just as a side note, since you have greater command over steering controls with "key is pressed" versus normal functionality, you might want to assign a couple extra options for lane shifting versus full on 90 degree steering.)
Hope this gives you an adequate springboard.
I'd show you a working version of this if I'd followed through with my original plan to do this in my own game. But I decided against widening the roads to conserve tile space, so it never happened. This is the method I would've used, though.
Just make sure you experiment with NPC placement and pixel checking. The rest should fall into place.
(And just a reminder, you can add sound effects to vehicles now if you're looking for realism.) _________________ Progress Report:
The Adventures of Powerstick Man: Extended Edition
Currently Updating: General sweep of the game world and dialogue boxes. Adding extended maps.
Tightfloss Maiden
Currently Updating: Chapter 2 |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu Feb 05, 2009 8:47 am Post subject: |
|
|
When I have finished adding slice support to map layers, the code to do this will look something like:
Code: |
global variable(1, big vehicle)
plotscript, embiggen vehicle, begin
big vehicle := load large enemy sprite(5)
realign slice(big vehicle, edge:center, edge:bottom, edge:center, edge:bottom)
#Assumes that your vehicle is NPC ID 10
set parent(big vehicle, npc slice(10))
end
|
And you would not have to bother freeing the big vehicle slice, since as a child of the NPC slice, it would get freed automatically when you left the map.
Of course, if you wanted to make the vehicle have different frames in different directions you would probably need something more like:
Code: |
global variable(1, big vehicle)
global variable(2, is riding big vehicle)
plotscript, embiggen vehicle, begin
big vehicle := load large enemy sprite(5)
realign slice(big vehicle, edge:center, edge:bottom, edge:center, edge:bottom)
#Assumes that your vehicle is NPC ID 10
set parent(big vehicle, npc slice(10))
end
plotscript, on mount big vehicle, begin
is riding big vehicle := true
end
plotscript, on dismount big vehicle, begin
is riding big vehicle := false
end
plotscript, each step script for big vehicle map, begin
if (is riding big vehicle) then
if(hero direction(me) == north)
then(replace big enemy sprite(big vehicle, 4))
if(hero direction(me) == south)
then(replace big enemy sprite(big vehicle, 5))
if(hero direction(me) == east)
then(replace big enemy sprite(big vehicle, 6))
if(hero direction(me) == west)
then(replace big enemy sprite(big vehicle, 7))
end
end
|
|
|
Back to top |
|
 |
The Drizzle Who is the Drizzle?

Joined: 12 Nov 2003 Posts: 432
|
Posted: Thu Feb 05, 2009 11:36 am Post subject: |
|
|
How would I ensure that it stays on the "road" so to speak? The npc would be the thing that responds to walls correct? _________________ My name is...
The shake-zula, the mic rulah, the old schoola, you wanna trip? I'll bring it to yah... |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu Feb 05, 2009 1:19 pm Post subject: |
|
|
The Drizzle wrote: | How would I ensure that it stays on the "road" so to speak? The npc would be the thing that responds to walls correct? |
Exactly, it would still behave just like a regular NPC/vehicle.
Think of the slice as the puppet, and the NPC as the hand. |
|
Back to top |
|
 |
The Drizzle Who is the Drizzle?

Joined: 12 Nov 2003 Posts: 432
|
Posted: Thu Feb 05, 2009 3:27 pm Post subject: |
|
|
Would it be possible (easily) to give the slice picture the same ability to be stopped by walls and npcs (and to pass over step-on npcs) that the regular vehicles have? _________________ My name is...
The shake-zula, the mic rulah, the old schoola, you wanna trip? I'll bring it to yah... |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Feb 06, 2009 6:37 pm Post subject: |
|
|
The Drizzle wrote: | Would it be possible (easily) to give the slice picture the same ability to be stopped by walls and npcs (and to pass over step-on npcs) that the regular vehicles have? |
Maybe eventually. I can't make any promises, but I don't see it as being impossible. |
|
Back to top |
|
 |
Spoon Weaver

Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Sat Feb 07, 2009 4:16 pm Post subject: |
|
|
you could just have a script that runs when you get in that embiggens the walls. Giving the illusion of the vehicle responding to walls. and of course another script would run that unembiggens the walls when you dismount the embiggened vehicle.
hehehe embiggen |
|
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
|