Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / I'm confused.. and prb hopeless

Author
Message
gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 16th Nov 2010 16:13
I'm trying to make a game where the player has to jump from one platform to another to reach the end. Each platform that the player lands on can change the player properties (e.g. increase the player's jump height, increase their speed etc.), however DB doesn't seem to recognize my code.

I have tried
and it doesn't seem to work, the player's speed still stays the same.

I have also tried
but DB doesn't recognize the command even though that is part of my movement code.

Can someone please explain to me the appropriate way to code what I want? I also need help with increasing the jump height as I'm not sure how to approach that either.

Here is the code I have so far (I borrowed the jump code from someone here on the forums)


Thanks in advance!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th Nov 2010 02:43
You need to assign the movement of the player to a variable or variables. It could be done like this:


For the downkey() movement, just take the value of speed# and divide by -3.

I'm not at my comp now or I could provide some more coding suggestions, but this should at least get you going.

gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 17th Nov 2010 05:55
Thnks LBFN!

There is a slight problem with the movement though, the player cube stutters when the speed is changed.. it goes back to normal when the player leaves the platform which increases its speed

This is what I have so far (if anyone has a suggestion for a better jump implementation I'm all ears too)
gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 17th Nov 2010 11:13
*Update*

i added a text to show up everytime the cube collides with the platform and it seems as tho the reason for the stuttering was because the collision between the player and the plain was constantly going on and off.

can someone please help to explain why it is so? I have updated my code (platforms arent arranged properly yet) a bit and here it is
gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 17th Nov 2010 15:50
*Update 2*

I am also having trouble with the speed up platforms, when i try

it doesn't seem to work and when I input it manually
it only works on the last object, albeit still with the jarring effect because collision is not working properly.

What am I doing wrong? Is it the placement of the code within the loop or something like that? I have tried putting the code in different areas but to no avail, I have also tried subtle variations of the code but all don't work either.


Here is my full code


The best part is, when I colour the platforms they don't work either. I really hope someone would take the time out to help me, I'm at my wits end and the frustration is killing me .

Thanks again in advance
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th Nov 2010 16:30
Okay, I was working on it when you posted again. Here is what I have so far. It is aggravating, in that certain platforms will not allow the player to jump.



As you can see, I have made several edits.

gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 18th Nov 2010 05:43
Thanks LBFN, I greatly appreciate your help however the can't jump on certain platforms is pretty much a game breaker so I can't incorporate your suggestions. I've been looking at your code and can't quite understand what you have done with the platforms and stuff (real noob me.. ).

I'm really trying to understand why the bugs in my game exist, because I have previously used the code that is causing these known bugs in my other games and they worked fine there.

These are my current known bugs:
- speed up only working on last speed up platform
- collision is on and off when the player cube is on a platform
- this has resulted in the removal of the timer extension platform
- colour not appearing on platforms
- when the race is finished the there is no text displaying the winning message

And here is my code again, I amended the speed up platform code but its still not working


Anyone kind enough to point out my errors?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Nov 2010 15:15
Quote: "Thanks LBFN, I greatly appreciate your help however the can't jump on certain platforms is pretty much a game breaker so I can't incorporate your suggestions. "

The problem was in the collision check for 6 - 9. This code fixes it:



I hesitate to spend the time to try and help you if you will not implement the suggestions I make.

gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 18th Nov 2010 15:38
Hey LBFN, didn't mean to upset you.. I really appreciate you taking the time out to help me.

I would actually like to decrease the speed and jump when the player is not on the respective platform. I tried



but this breaks the speed increase, is there a better way to do this?

Once again, really appreciate your help!!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Nov 2010 15:57
Quote: "Hey LBFN, didn't mean to upset you.. I really appreciate you taking the time out to help me."

Okay. By you presenting your updated code without anything that I did in it, it came across as it was being tossed aside and my effort was in vain. I like to help others, but if I do, I want them to at least consider what I am suggesting.

Anyway, the code here will cause the speed to be at .1 unless you are colliding with platforms 3 through 5, which is most of the time. There are different ways to handle this. Some ideas:
1. You could implement a timer that allows the speed increase for a certain amount of time. You could maybe change the player's color while at fast speed or perhaps place a second timer showing the time left for high speed. I don't recommend this one, but wanted to throw it out as a suggestion.
2. You could allow the speed increase to continue the rest of the game.
3. You could have the speed go back to normal if a different platform is collided with.

gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 18th Nov 2010 16:32
Quote: "
Okay. By you presenting your updated code without anything that I did in it, it came across as it was being tossed aside and my effort was in vain. I like to help others, but if I do, I want them to at least consider what I am suggesting."

Sorry it was pretty rude of me in hindsight and it was a noob mistake.. Won't happen again while I'm here..

I have taken your advice on board and amended the speed code


works well enough, thanks to you

Now I'm trying to colour code the platforms so the player is aware of which platform provides which power up.. I have inserted the code for that before,inside and after the main loop but the platforms are still grey.. Is there a trick to this? my code is real simple and straightforward
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Nov 2010 16:47 Edited at: 18th Nov 2010 17:06
We are going to need to get on the same page with the code. I will see if I can implement your changes with mine to make it work.

As to coloring the platforms, try SET OBJECT AMBIENCE ObjectNumber,rgb(red,green, blue) [plug in the same RGB values used to color them) after you color them. It should work.

gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 18th Nov 2010 17:18
Tried your suggestion but i must be doing it wrong because it doesn't work.. I feel like a broken record here I'm so sorry for being hopeless.. I tried adding in the SET OBJECT AMBIENCE ObjectNumber,rgb(red,green, blue) and turned off the `color object 2, rgb but still no luck on the colour..

Anyway to facilitate your understanding of what i have done here is the updated code in full


Note I have also changed the jump increase code back to my original as it behaved like how I wanted it to (just wanted increased jump for the duration of the player on that platform) despite the collisions going on and off.

I am going to bed now as it is 3.15am here in Melbourne, Australia. So many thanks for your generous help and I will take a look at this post again tom when I get up.

Cheers LBFN!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Nov 2010 17:35
It's funny, I was working with another coder the other day and found out he is from Australia also. You know you're a serious coder when you are still up at 3:15am working on something.

Anyway, I had been working on combining the code into one also. Take a look at this:


I am using plane 15 for the final goal. The planes all show their colors properly, and everything seems to work okay. Take a look and see if there is anything you want changed. It also shows the current object that is being collided with - this was only put in to help me and is for debugging purposes.

If you run out of time, it will tell you and then end. If you reach plane 15, it congratulates you and ends.

gormee
14
Years of Service
User Offline
Joined: 10th Oct 2010
Location:
Posted: 19th Nov 2010 05:36
Hey wow, the game works great now! Really appreciate your help LBFN! Unfortunately I have to concentrate on my sch work now, I don't have much time to refine this idea further.

Might try another idea again when all my assignments have been handed in next week. I'm trying rapid prototyping because its encouraged by my teachers (I'm studying to be a game designer).

Thanks again for all your advice!

Login to post a reply

Server time is: 2024-11-23 07:31:11
Your offset time is: 2024-11-23 07:31:11