Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,184 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Jump Action Crash #435154
01/03/14 14:50
01/03/14 14:50
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Hi,
I'm working with AUM #103 Shooter Template. I've got my game almost complete but I get a crash when I publish it (works fine from WED though).

I've isolated it to one line of code:
vertical_speed.z = t_jump * 0.25;

If I change the code to this, it works fine:
vertical_speed.z = tshooter_jump * time_step;
However, the player jumps way too high for my game.

Anyone have a suggestion on how to rewrite this line of code?

Re: Jump Action Crash [Re: mschoenhals] #436499
01/28/14 04:44
01/28/14 04:44
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Can you multiply the tshooter_jump variable by 0.25 before this line of code?


tshooter_jump = tshooter_jump * 0.25;//add this line first

vertical_speed.z = tshooter_jump * time_step;

Re: Jump Action Crash [Re: Dooley] #452186
06/05/15 18:02
06/05/15 18:02
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Unfortunately, this still doesn't work. It works fine with the Commercial version but my students have the student version. I've changed the line to exclude time_step thinking that was causing the error:

vertical_speed.z = t_jump * 0.35;

Works fine on the Commercial but causes a crash for the student version. Is there another way to write code for jump?

Re: Jump Action Crash [Re: mschoenhals] #452189
06/05/15 20:00
06/05/15 20:00
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
okay looks like you found what "appears" to me like a coding mistake in the template script .

I quickly looked it over and saw that the jump_handle was localy defined inside the t_player action but never assigned to a sound wich was called in another function t_player_jump .

to fix this (don't know if we are allowed but I fixed mine) :

open up t_player.c file in SED , the file is located inside of your gamestudio installation folder \include sub folder .

once opened inside SED , scroll down to the "action t_player() " function , then change :

Code:
var current_height = 0, jump_handle;



to

Code:
var current_height = 0;



then go to line 40 and add this as a global variable:

Code:
var jump_handle;



now scroll down to "function t_player_jump ()"
then change from :

Code:
snd_play(shooter_jump,70,0);



to :

Code:
jump_handle=snd_play (shooter_jump,70,0);



save t_player.c , now publish your project and test

enjoy.


Compulsive compiler
Re: Jump Action Crash [Re: Wjbender] #452194
06/05/15 22:50
06/05/15 22:50
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Wow! That works! Thank you programming god! laugh

How is it that you went about figuring it out? Any tips for a beginning coder?

Thanks again.

Re: Jump Action Crash [Re: mschoenhals] #452199
06/06/15 01:08
06/06/15 01:08

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
Wow! That works! Thank you programming god!

high praise indeed

Re: Jump Action Crash [Re: ] #452200
06/06/15 07:39
06/06/15 07:39
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
like they say "follow the money trail" , so you follow the program flow and trace the problem. .

yeah I am no programming god , I am sure I wil require your help one day.

but..

to legitimately answer your question , and I am sure you went about it the same manner as I , since it happens when pressing space ,we simply jump to where space is handled , if the problem is not easy to spot and you do not understand the problem then , you can resort to trial and error like : start commenting code out piece by piece and publish everytime until you figure out which code area holds the mistake , then you simply can trace whatever is used in that area (variables/functions/pointers) to find the cause , if things get really hairy you can always use printf or DEBUG_VAR to help out , the point being to always check any values / pointers / functions / variables in the area you have traced .

if however you understand the language and engine better , you can approach the problem more methodical , I basically just jumped to the space handled code and looked at everything used there , then I quickly spotted that the sound handle was an uninitialised variable , since it needed to be assigned to something I traced to where the sound was to be used and connected the dots ..

other than that , all I can really advice you on is ,that every mistake is an opportunity to learn , mistakes wil teach you more than anyone can ever teach you , why ? Because one's you have gone through hell to find out what went wrong , you won't forget it because you actually learned to understand the mistake .

there wil come a time when bug hunting becomes fun , but all of us go through this mistakes even after years of coding , the simplest of mistakes have at times given me headaches like adding 2 ";;" at the end of a line ,almost impossible to spot at times .

with SED my advice is to do as my signature states , compile often (publish often) after code additions / changes , and as always check values/pointers before using them with "if clauses" or functions/macros you have written to do it for you.




Last edited by Wjbender; 06/06/15 10:29.

Compulsive compiler
Re: Jump Action Crash [Re: Wjbender] #452202
06/06/15 10:51
06/06/15 10:51
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
and another heads up : in that same file "pragma_path" is used , and that statement is not supported in the published version .


Compulsive compiler
Re: Jump Action Crash [Re: Wjbender] #452208
06/06/15 15:34
06/06/15 15:34
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Thanks Wjbender!

A great response. Yeah, I was trying to comment out the code and could isolate the issue. I need more work on my programming; it's taking some time.

Thanks again for your help.
smile

Re: Jump Action Crash [Re: mschoenhals] #452212
06/06/15 19:37
06/06/15 19:37
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
headaches like adding 2 ";;"

I had yesterday...but luckily found it quick grin


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1