Scrolling Game Development Kit Forum

SGDK Version 1 => Help/FAQ => Topic started by: slezak_2005 on 2005-06-16, 09:45:44 PM

Title: Any way to make accelerating cars?
Post by: slezak_2005 on 2005-06-16, 09:45:44 PM
Hello, I just joined these boards (I LOVE SGDK by the way) and I was wondering:

I am making a racing game. Is there any way (preferrably without scripting) to make the cars accelerate?

Thanks in advance. And by the way, SGDK RULES!
Title: Accelerating
Post by: bluemonkmn on 2005-06-17, 05:44:40 AM
You mean more slowly than a normal sprite?  Can't think of a way without scripting.  But why is everybody so against scripting?  :?

All sprites accelerate though.

Also, BTW, you may want to fix your email address.  I got a notification from phpBB that the email address you used is one that has been discontinued.
Title: Re: Accelerating
Post by: billybob884 on 2005-06-17, 08:51:28 AM
Quote from: "bluemonkmn"
But why is everybody so against scripting?  :?


well, im against it cuz i dont know how to script, and i don't want to have to rely on you guys all the time, lest i wear out my welcome... ;)
Title: Any way to make accelerating cars?
Post by: durnurd on 2005-06-17, 09:43:07 AM
But in a general sense, SGDK was originally designed to be a game development kit with scripting as a necessity.  (At least, that's how I understand it.)  Scripting really expands your ability to make games with this kit!

I don't think you should be averse to using script there, buddy.
Title: Extra questions
Post by: slezak_2005 on 2005-06-17, 06:22:26 PM
Oh, I'm sorry, I didn't mean to say I was against scripting, I just said I'd prefer a way without scripting because I have never used it in SGDK, but I'll try anything once.

  And by the way, by accelerating, I meant getting progressively faster (increasing the speed that the sprite moves... Isn't speed "x pixels per frame" or something like that?)

  Also, I fixed my E-mail so now it's working.

EDIT: Oh, by the way... (What was I going to ask...?)
Oh, that's right, Is there any way to make a map so the player can select the color they want their car to be? Scripting is fine. I just don't want the player being stuck with a red car the whole time if he/she wants, say, fuschia...(Even though fuschia isn't in the game... :) ) Thanks!

EDIT2: And also, if I'm going to be making 6400x6400+ giant "city" maps, is there any way I could possibly copy an entire map and edit its copies to make the individual tracks? If not, I can handle the tedium, I was just wondering. If it makes it easier, I won't put any paths or special functions on the template map. Just tiles.
Title: Any way to make accelerating cars?
Post by: durnurd on 2005-06-17, 11:40:07 PM
The possibilities become much grander when using script.  You would almost certainly have to use script to copy a created large city background from another map.  The code would go about this by creating a new layer on each map, the very background-most layer, setting the layer in front of it to be transparent, then looping through the template layer's tiles and copying them over 1 by 1.  Also, you'd have to be careful to make sure the layer was using the correct tileset and the map was the correct size.

Also, yes you can allow the player to select a car color even without scripting.  You will need X inventory items with max set to 1 and initial set to 0 where X = # of possible colors - 1, each one invisible.

Then, in each level, have X global special functions that are deleted upon use, each using one of the inventory items (require it but don't use it up) which switches to the new sprite (with the new color).  Same location as old, retain old state, swap controlled by, new sprite, delete old sprite.

On the map to select which color you want to use, just add one to the coinciding inventory (and remove 1 from all others if you want to be able to change numerous times!).  If you want to be able to do this using a menu, see how menus are implemented in the GameDev Academy (http://sourceforge.net/project/showfiles.php?group_id=70424&package_id=112715).

Thankfully, I think we were all talking about the same thing when speaking of acceleration. Speed is measured in distance per time, and acceleration is (distance per time) per time
Title: Any way to make accelerating cars?
Post by: bluemonkmn on 2005-06-18, 08:21:17 AM
GameDev sprites do accelerate, jsut very quickly -- 1 pixel per frame per frame.  So often times after only 4 frames (about 0.1 seconds) you're going max speed already.  GameDev doesn't have a built-in way to control acceleration speed.

If you create a large map without any sprites or anything, you might be able to just copy the file to a new name and edit the GDP to add it to the project with a different name.  I don't remember if I've tried that though.  (You'd also have to increase the mapcount in the GDP file).  The GDP file can be edited in notepad.
Title: Any way to make accelerating cars?
Post by: slezak_2005 on 2005-06-18, 02:23:26 PM
Ahhh... Thanks all, I think this is actually help to everyone. I will put this to good use, and credit you in the game if you wish.
Title: Any way to make accelerating cars?
Post by: durnurd on 2005-06-19, 04:32:21 PM
I don't think there's any need to credit either BlueMonk or myself in the game, as he made the program, I am listed on the main page as a program tester, and the help we're giving isn't all that much help :)
Title: Any way to make accelerating cars?
Post by: Gohst on 2005-07-06, 05:49:04 AM
If you have a funny little thing in the corner then it could be a picture which says "gears" or something and each time you pressed up, it would switch to a higher gear

When you did that, switch to a sprite with higher speed