turnSpeed

Learn to use DS Game Maker by Example.

Re: turnSpeed

Postby Brian.Washechek » February 6th, 2014, 4:00 am

Okay. I tried rotating the ship then following your directions, but ran into an error that I don't even come close to understanding. Do think you could help?
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Buck_7 » February 6th, 2014, 4:48 am

Sorry, I can't test the game out but I can somewhat view the code. Could you tell me the error?
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » February 6th, 2014, 5:27 am

"C:\DSGMTempDisruptedForce1-31-201425212161>make
Build process start for project "DSGMTempDisruptedForce1-31-201425212161"...
.
lower_screen_background_Map.bin
lower_screen_background_Pal.bin
lower_screen_background_Tiles.bin
main.c
In file included from c:/DSGMTempDisruptedForce1-31-201425212161/source/main.c:6
:0:
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h: In function 'Fal
se_Deceiver_ObjectButtonHeldLeft_Event':
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h:46:41: error: lva
lue required as left operand of assignment
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h:47:41: error: lva
lue required as left operand of assignment
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

C:\DSGMTempDisruptedForce1-31-201425212161>pause
Press any key to continue . . ." <---That
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Nobody » February 6th, 2014, 6:00 am

look in you "False_Deceiver_ObjectButtonHeldLeft_Event'". Somewhere your code you assigned a value to a parameter wrong.
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 Buck_7 » February 6th, 2014, 11:10 pm

Ah, okay. Thanks. I'll highlight the keywords that are important...


sckuz254 wrote:"C:\DSGMTempDisruptedForce1-31-201425212161>make
Build process start for project "DSGMTempDisruptedForce1-31-201425212161"...
.
lower_screen_background_Map.bin
lower_screen_background_Pal.bin
lower_screen_background_Tiles.bin
main.c
In file included from c:/DSGMTempDisruptedForce1-31-201425212161/source/main.c:6
:0:
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h: In function '
False_Deceiver_ObjectButtonHeldLeft_Event':
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h:46:41: error:
lvalue required as left operand of assignment
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h:47:41: error:
lvalue required as left operand of assignment
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

C:\DSGMTempDisruptedForce1-31-201425212161>pause
Press any key to continue . . ." <---That


Okay so by looking at it you can tell that there is something wrong in the
False_Deceiver_Object and something to do with
lvalue required as left operand of assignment

So now you know where to look - In the False_Deceiver_Object and in the ButtonHeldLeft_Event.

Knowing that much should be enough but what about the lvalue required as left operand of assignment? Well that usually means that the code missing something.

It's hard for me to tell since I can't view the code that well, but maybe the problem lies in the object Button Held Left in the excecute action. Try looking there and see if anything is wrong.
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » February 7th, 2014, 3:11 am

[X] + PA_Cos(Spin)+=0.1;
[Y] - PA_Sin(Spin)+=0.1;
It's complaining about those and I don't know why....
They seem fine to me...

P.s.
This a work in progress, nowhere even close to completion yet, so don't judge the code... I'm pretty sure if it were a person, it wouldn't judge you...
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Brian.Washechek » February 7th, 2014, 3:38 am

I get why it doesn't like those well......Basically Game Maker feel like stepping back from using the C++ code and stepping back into the ."D.S. Game Maker"'s "simple" mode.

I may not want to do that... Does anyone feel the same, or am I just being weird??
Last edited by Brian.Washechek on February 7th, 2014, 4:25 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 » February 7th, 2014, 3:48 am

sckuz254 wrote:I get why it doesn't like those well...... not '"why" but i could find a way to make it work, but it includes stepping back from using the C++ code an stepping back into the ."D.S. Game Maker"'s "simple" mode, and I don't exactly want to do that...

Nothing wrong with simple mode. I find a bit more respect in people who make their own actions for 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 Buck_7 » February 7th, 2014, 4:20 am

sckuz254 wrote:[X] + PA_Cos(Spin)+=0.1;
[Y] - PA_Sin(Spin)+=0.1;
It's complaining about those and I don't know why....
They seem fine to me...

P.s.
This a work in progress, nowhere even close to completion yet, so don't judge the code... I'm pretty sure if it were a person, it wouldn't judge you...


Oooh, I see.
You can just delete that whole code because you already have that similar code in the Up held event.

But the problem was:

[X] + PA_Cos(Spin)+=0.1;
[Y] - PA_Sin(Spin)+=0.1;

It should have been:

[X] += PA_Cos(Spin)+0.1
[Y] -= PA_Sin(Spin)+0.1

So yeah. You already have it in the up held so delete the code you have.
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » February 7th, 2014, 4:30 am

I tried that and it says
"
C:\DSGMTempDisruptedForce1-31-201425212161>make
Build process start for project "DSGMTempDisruptedForce1-31-201425212161"...
.
lower_screen_background_Map.bin
lower_screen_background_Pal.bin
lower_screen_background_Tiles.bin
main.c
lower_screen_background.c
.
Linking...
main.o: In function `Set_Sprite':
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h:98: undefined ref
erence to `False_Deceiver_Image_Sprite'
main.o: In function `Room_1':
c:/DSGMTempDisruptedForce1-31-201425212161/source/main.c:49: undefined reference
to `DSGMPal0_Pal'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/DSGMTempDisruptedForce1-31-201425212161/DSGMTempDisruptedForce1
-31-201425212161.elf] Error 1
make: *** [build] Error 2

C:\DSGMTempDisruptedForce1-31-201425212161>pause
Press any key to continue . . ." I honestly don't get it... doess anyone?
Last edited by Brian.Washechek on February 7th, 2014, 4:33 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 Nobody » February 7th, 2014, 4:42 am

sckuz254 wrote:I get why it doesn't like those well......Basically Game Maker feel like stepping back from using the C++ code and stepping back into the ."D.S. Game Maker"'s "simple" mode.

I may not want to do that... Does anyone feel the same, or am I just being weird??

DSGM runs on C code, not C++

sckuz254 wrote:I tried that and it says
"
C:\DSGMTempDisruptedForce1-31-201425212161>make
Build process start for project "DSGMTempDisruptedForce1-31-201425212161"...
.
lower_screen_background_Map.bin
lower_screen_background_Pal.bin
lower_screen_background_Tiles.bin
main.c
lower_screen_background.c
.
Linking...
main.o: In function `Set_Sprite':
c:/DSGMTempDisruptedForce1-31-201425212161/include/GameWorks.h:98: undefined ref
erence to `False_Deceiver_Image_Sprite'
main.o: In function `Room_1':
c:/DSGMTempDisruptedForce1-31-201425212161/source/main.c:49: undefined reference
to `DSGMPal0_Pal'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/DSGMTempDisruptedForce1-31-201425212161/DSGMTempDisruptedForce1
-31-201425212161.elf] Error 1
make: *** [build] Error 2

C:\DSGMTempDisruptedForce1-31-201425212161>pause
Press any key to continue . . ." I honestly don't get it... doess anyone?

seems like all you have to do is signify the graphics change
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 » February 7th, 2014, 4:49 am

I group C an C++ together, but chances are that's due to my lack of experience programming.
Last edited by Brian.Washechek on February 7th, 2014, 5:11 am, edited 6 times in total.
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Buck_7 » February 7th, 2014, 4:53 am

Well, there should be a tab... Look for it in options -> Advanced -> Signify graphics change?
Then after that you can test the game again.
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby Brian.Washechek » February 7th, 2014, 5:08 am

OK, That worked, but time has come for me to call it a night... I'll work on this tomorrow, though... I'll most likely be back with more questions..
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Brian.Washechek » February 7th, 2014, 5:24 am

James: D.S. Game Maker is really in need of an "undo" button...
Last edited by Brian.Washechek on February 7th, 2014, 6:02 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 Brian.Washechek » February 7th, 2014, 5:42 am

Well... This is the current build... I have failed in making the ship fly straight...

Tonight, if you want to, you can try to make it fly straight.
I would really appreciate that.

Although, I'll work on it tomorrow, regardless....
Attachments
Disrupted Force 2-6-2014.dsgm
(71.64 KiB) Downloaded 245 times
User avatar
Brian.Washechek
 
Posts: 284
Joined: April 22nd, 2012, 1:06 am
Location: Casper, Wyoming

Re: turnSpeed

Postby Buck_7 » February 8th, 2014, 2:57 am

I found a few things in the code that don't look right.

First off, in both the right and left held events you seem to have:

Set Variable Turnspeed to TurnSpeed+.1

Turnspeed is not a float so you should remove the "." dot from the code.
Actually none of your variables are floats anymore(which is okay but...)

Wait a minute it seems you have mixed up the code throughout 3 different objects.

  • First step - Put all the code in only one object then delete the other unnecessary objects
  • Second step - remove all unnecessary dots "." from the set variable codes and anywhere else you find them EXCEPT for the variable FallSpeed
  • Third step - Make FallSpeed a float. Remember where you declare variables? Go there and click on FallSpeed then click on float to the right.

So now you should be 3 steps closer to getting your ship to move properly(I hope).
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Re: turnSpeed

Postby nicklausw » February 8th, 2014, 5:00 am

Sckuz, may I honestly suggest you scrap this entire system of physics and start over in a way that we can understand?
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 » February 8th, 2014, 5:17 pm

What!? No! Don't do that! I think it's fine. Everything makes sense to me. Maybe it's kind of messy for you guys but he has the right idea.

If I were to code this it would be like:

Sprites
  • False_Deciever_Sprite (Ship top should face horizontally right)

Global Variables
  • Integers
    • Spin = 128
  • Floats
    • FallSpeed = 0
    • TurnSpeed = 0

False_Deciever_Obj
  • Create Event
  • Step Event
    • Execute Code
      Code: Select all
      Spin += (Pad.Held.Left - Pad.Held.Right)*2 //Change the angle of the ship

      //Angle variable boundaries
      if(Spin<0)  Spin = 512
      if(Spin>512)Spin = 0

      Set_Angle([Me], Spin+TurnSpeed) //Set the ship's angle

      //Gravity?
      if(FallSpeed<2)FallSpeed += 0.02
      [Y] += FallSpeed

      //Move ship in direction it's facing
      PA_SetSpriteXY (Instances[[Me]].Screen, [Me], [X] + PA_Cos(Spin),[Y] - PA_Sin(Spin))

      //TurnSpeed
      if(Pad.Held.Right&&TurnSpeed<4)TurnSpeed+=0.1
      if(Pad.Held.Leftt&&TurnSpeed>-4)TurnSpeed-=0.1

      if(!Pad.Held.Left&&!Pad.Held.Right){
         if(TurnSpeed>0)TurnSpeed-=0.1
         if(TurnSpeed<0)TurnSpeed+=0.1
      }

I can't test this out so there's probably a few mistakes but this should be very close...
User avatar
Buck_7
 
Posts: 1459
Joined: February 19th, 2011, 1:44 am

Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron