turnSpeed

Learn to use DS Game Maker by Example.

turnSpeed

Postby Brian.Washechek » January 16th, 2014, 5:17 am

In my game I would like to have the float value called "turnSpeed". The rate of its acceleration and deceleration is a value i will chose after the levels are better built.

I grasp the logic perfectly. just don't know how to make DS Gamemaker to do it too.

Can anyone help me?

There is probably a standard.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby nicklausw » January 16th, 2014, 5:27 am

Mint's ActionPak (all by me :3) has an action that handles that, but you can't have it on the variables page.

viewtopic.php?f=20&t=3777

Download the zip and extract the contents to the Actions folder of DSGM.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: turnSpeed

Postby Buck_7 » January 16th, 2014, 10:08 pm

You're not really making much sense. You can declare a float in the global variables like you would normally do for an integer, boolean, or string...and to control the float, say for example, with the d-pad, all you have to do is:

if(Pad.Newpress.Up) turnSpeed += 0.125
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby nicklausw » January 16th, 2014, 11:33 pm

Buck_7 wrote:You're not really making much sense. You can declare a float in the global variables like you would normally do for an integer, boolean, or string...and to control the float, say for example, with the d-pad, all you have to do is:

if(Pad.Newpress.Up) turnSpeed += 0.125

Who's not making much sense, me or him?

I believe he doesn't want the float to have a value right at the beginning. It's a useless request, but hey, might as well respond.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: turnSpeed

Postby Buck_7 » January 17th, 2014, 12:29 am

Oh, I meant sckuz254. Still, I can't believe how easy these problems are, and yet sckuz254 is having one heck of a time solving them. Most unlucky person lol
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » January 20th, 2014, 4:34 am

You'll have to forgive me, I'm very new to DS game maker however I'm not new to video game programming.

Ehhhhh... would you please download my game and then adding fallSpeed into it or giving me a proper description of how to add it myself?

The idea is pretty simple... fallSpeed * =1.02 and my False_Deceiver's y value = False_Deceiver + fallSpeed.

It's supposed to make him fall faster over time. Am I barking up the wrong tree here? Please download my game and plug it in for me if you've decided a better way to do it... Because I don't really understand how the .action files are used..

Could you please describe to me how .action files are used, too?

Until i figure how I will do combat with the gravity dragon, there is none!

Right now my comment to you is marked "to DS Game Maker Forum on 1/19/2014:" under False_Deceiver_Object >> Step . Please, I know I'm slaughtering how things are refer to here, so feel free to correct me!
Attachments
Disrupted Force.dsgm
(63.94 KiB) Downloaded 228 times
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Buck_7 » January 22nd, 2014, 12:44 am

Sorry I am unable to download/run your game but I'll try to give you some help...

So, first go to global variables, then create a new variable called fallSpeed and make sure it's a float. To make it a float all you need to do after you have named your variable is click on the word float to the right of the window.

Now, to add the gravity to the ship open up the False_Deceiver object , add the step event, and drag the excecute code action from the bottom of the action window in the advanced tab.

After you have add the action, double click it. The action will open a new window in which you must place:

Code: Select all
fallSpeed  += 1.02
[Y] += fallSpeed


Don't forget to put the object in a room.

Hope you get it now :lol:
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » January 22nd, 2014, 3:08 am

I fail to see where you can change what [Y] is stored as... fallSpeed can be set as a float, but I'm not seeing were i can set [Y]'s variable type..
Attachments
Dirupted Force 1-21-14.dsgm
(481.26 KiB) Downloaded 231 times
Last edited by Brian.Washechek on January 22nd, 2014, 3:17 am, edited 1 time in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby nicklausw » January 22nd, 2014, 3:13 am

[Y] can't be a decimal. When you scroll the cursor around the room, there's never decimals. Well, then again...well, all I can say is, pretty sure [Y] (the location of the object) is an int.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: turnSpeed

Postby Brian.Washechek » January 22nd, 2014, 3:20 am

Cool, however I can't figure out where my [X} and {Y] values are stored. I'm pretty sure that they're seen as Ints when they should be Floats. The ship kind of shakes as it falls.
Attachments
Dirupted Force 1-21-14.dsgm
(481.26 KiB) Downloaded 231 times
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby nicklausw » January 22nd, 2014, 3:20 am

I found a fix: just make fallSpeed an int.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: turnSpeed

Postby Nobody » January 22nd, 2014, 3:21 am

I'm 99.9999999999999999999999999999999999999999999999999999% sure Mint is correct on this one. [Y] can't and never will be a decimal. It is programmed to be an int and objects are plotted with whole numbers. Without being said gravity can still be a decimal; however, only the whole number will be used when adding the value to the position and the decimals will be chopped off when the code is run. Regardless the gravity affect will work the same, there just won't be non-whole number coordinates
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: turnSpeed

Postby Brian.Washechek » January 22nd, 2014, 3:29 am

Can you upload this fixed version of my game, then? Plus an explanation of what you've done? Because I only see Spin, Angle, Speed, HP an fallSpeed as editable. I don't know where [X] a [Y] are.
Last edited by Brian.Washechek on January 22nd, 2014, 3:50 am, edited 1 time in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby nicklausw » January 22nd, 2014, 3:31 am

sckuz254 wrote:Can you upload this fixed version of my game, then?

All I did was go to the global variables page, click on "fallSpeed", select "Integer", X out the variables page, compile, and the ship moved only when I told it to.

As for the barriers around the room...I'd recommend a camera-moves-with-ship sort of thing instead of getting into crazy walls and stuff.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: turnSpeed

Postby Nobody » January 22nd, 2014, 3:53 am

sckuz254 wrote:Can you upload this fixed version of my game, then? Plus an explanation of what you've done? Because I only see Spin, Angle, Speed, HP an fallSpeed as editable. I don't know where [X] a [Y] are.

all you do is use the set variable action and type in [X] or [Y] as the variable name.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: turnSpeed

Postby Brian.Washechek » January 22nd, 2014, 4:43 am

Yes, the camera followed your ship in "Force Disruptor", the games pseudo-prequel. I was planning on at least using the levels in the games pseudo-sequel "Disrupted Force".

Why don't have the code for "Force Disruptor", you ask...

The reason my code wasn't saved was because of my very former friendship with Bill Eckerson He ONLY saved the executable, not the code. The games were my first project, so it made sense they were programmed in Visual Basic.

Man.... I really wish I had the code for the game. You can look at the executables if you want but the fact that decompilation is basically impossible, that ship of hope subsided a long LONG L-O-N-G time ago.

You can look at he executables. I can't get them to run on all the computers I've tried, save one. It depresses too much to deal with the un-editable project. I plan on using the .lvl files in the game i'm currently working on. But that checkpoint is so far away, I don't want to even start planning for it.
Attachments
Force Disruptor.7z
<sigh.
(1.99 MiB) Downloaded 223 times
Last edited by Brian.Washechek on January 23rd, 2014, 12:33 am, edited 2 times in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Buck_7 » January 22nd, 2014, 7:05 pm

Nobody wrote:I'm 99.9999999999999999999999999999999999999999999999999999% sure Mint is correct on this one. [Y] can't and never will be a decimal. It is programmed to be an int and objects are plotted with whole numbers. Without being said gravity can still be a decimal; however, only the whole number will be used when adding the value to the position and the decimals will be chopped off when the code is run. Regardless the gravity affect will work the same, there just won't be non-whole number coordinates


Oh, that's right. Well, what I do in my platformer game was use a separate float like PlayerY and then add the gravity or in your case, sckuz254, fallspeed. Then use the PA_SetSpriteY(screen, obj, y).

First Declare your floats PlayerY and fallSpeed

Then add this code exactly into your object step event using the execute action as said before:

Code: Select all
fallSpeed += 1.02
PlayerY += fallSpeed
PA_SetSpriteY(Instances[[Me]].Screen, [Me], PlayerY) //[Me] is the object number


Okay, for each object you create, they have X and Y coordinates. You can set an object's position by changing their X and Y values. The object's X and Y values are represented with [X] and [Y]. So as said before you can do

[X] = 64
[Y] = 64

Don't question how they work - they just do :lol: You can do this for any object.

OR you can do:

Instances[Object_Number].X = 64
Instances[Object_Number].Y = 64

The code here are the same as above ([X] and [Y]), but for this code you'll have to specify the object number:

Instances[0].X = 64
Instances[0].Y = 64

OR

Instances[[Me]].X = 64 //Yes, EXACTLY like this! You don't need to declare any variable!!
Instances[[Me]].Y = 64

the [Me] gives the object's number so you don't need to find out which number the object is. Don't question it - it just works :lol:

But in the end It's much easier doing the [X] = 64 and such.

The objects [X] and [Y] variables are declared outside of DSGM that's why you don't see them in the declare variables.

By the way, My computer won't boot up anymore so I can't work on anything :(
User avatar
Buck_7
 
Posts: 1460
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » January 30th, 2014, 3:53 am

Okay, i want to apologize for my previous question. My head quit working for several seconds.

Now, I want the ship to rotate faster clockwise or counter-clockwise faster when the button is held for more than a second... And I've got it working, left only for now.

I just need it to accelerate rotating whenever the direction key is pressed for a very short while. I've uploaded my current work on the project.

In C++, I could do this by detecting if "left a right are not being pressed". However, I don't know how DS Game Maker "words" it.
Attachments
Disrupted Force 1-29-2014.dsgm
(479.26 KiB) Downloaded 235 times
Last edited by Brian.Washechek on January 30th, 2014, 4:47 am, edited 2 times in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby nicklausw » January 30th, 2014, 4:43 am

sckuz254 wrote:Okay, i want to apologize for my previous question. My head quit working for several seconds.

Now, I want the ship to rotate faster clockwise or counter-clockwise faster when the button is held for more than a second... And I've got it working, left only for now.

I just need it to accelerate rotating whenever the direction key is pressed for a very short while. I've uploaded my current work on the project. I have no idea how DS Game Maker "words" it.

In C++, I could do this by detecting if "left a right are not being pressed". However, I don't know how DS Game Maker wants it...

..Where is the file?
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: turnSpeed

Postby Brian.Washechek » January 30th, 2014, 4:49 am

Heh--heh, there /\ I'm going to bed now, however I'll read your replies tomorrow..
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Next

Return to Tutorials

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron