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.

Author
Message
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 10th Dec 2005 13:33
ok for this game im making, a number is at the top of the screen which indicates how much money the player has. At the moment the number is at 0. If the player was to come in to collision with a small cube which represents money then 20 has to be added to the 0 heres the code ive got (the player is object number 10)



so thats what happens when the player comes into contact with the money. It goes giving the impression that the player has picked it up. What i need to know, how to do, is how i can add 20 (the value of the money) to that 0 at the top of the screen when the player comes into collision with the money.
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 10th Dec 2005 14:35
uh...is that all the source you have?

to add 20 to the money variable, use

when the player collides with the cube.

You also need a loop to be able to move around and get the cube.
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 10th Dec 2005 15:17
well you''d have to print the varialble of money. when you pick the money up you will add 20 to that string.



Don't look at my sig!
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 10th Dec 2005 15:17 Edited at: 10th Dec 2005 15:18
as in this?

start the money off at zero...



then show how much money the player has...



add 20 to the amount of money if you touch some money...



Edit: Grrr - Link 102 was slightly faster

...maybe one day I'll finish a project
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 10th Dec 2005 16:21
Brilliant!!! thanks alot it works
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 10th Dec 2005 16:43
ive used it and now ive found out if i use this

if chash=1000

(1000 being the money if reached to that amount)

then i can make different events happen within that and endif

for example ive done somthing like this

if chash=1000
color object 10,rgb(100,0,0)
endif
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 10th Dec 2005 18:13
Yeah, youre getting there!
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 10th Dec 2005 21:49
right ive tried to use that code as health for an enemy. The enemy has 100 life and the player bullet takes away 25 life. Each time the bullet touches the enemy it should take away 25 life but for me when it touches the enemy it takes away that 25 life but then it goes back to 100 when the bullet passes. How can i get it so the -25 life stays on the enemy health counter. Heres the code

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 10th Dec 2005 22:18
Woa! Why is your code indented like that? It looks very strange


Just what I thought, you put the enemy health inside the do-loop. Put it before the do command like this:
It is also best to print stats right before the sync.
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 10th Dec 2005 22:57 Edited at: 10th Dec 2005 22:58
Easy! You had

IN the loop, so everytime you go back to the top of the loop, the health would go to 100
here is the WORKING code. I changed the way he loses health a tiny bit, and made the bullet stop when it hits it.


Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 10th Dec 2005 22:59
Oh dahm it was soooooooo obvious!!!!! im so stupid, thanks for pointing that out
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 10th Dec 2005 23:01
no problem. Even I make mistakes like that.

Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 11th Dec 2005 22:12 Edited at: 11th Dec 2005 22:14
right my next question is posted here because i dont want to start a new thread. This is to do with my previous question in the sense of that enemy cube thing. How do i get the enemy cube to follow the player IF when he shoots the enemy and the enemy health goes down to 90. When the cube does follow the player and the player stops moving the cube will stop just a bit away from the player so in theory the cube stays just a small distance away from the player each time the player moves and one face of the enemy cube stays looking at the player. I am looking for this as a simple form of AI and if someone can work around the code that is already posted above i would be very gratful.
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 12th Dec 2005 08:02 Edited at: 12th Dec 2005 08:02
it is much easier just to use text 0,0,"Money" than using set cursor 0,0 : print "money" isn't it?

Takeshii
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location:
Posted: 14th Dec 2005 06:18 Edited at: 14th Dec 2005 06:20
Quote: "WOW! pro g r ammer, you really ARE the best programmer i've ever seen! i mean, who could possibly figure out how to add 20 to a variable?? "


Wow, what has the world come to. I mean that kind of critisism doesnt help anyone, sarcastic or not, and joking or not, its what i like to consider, in my opinion a flame. There is a fine line between criticizing to help somone, and flaming. To me, you just look like an ***. Plain and simple. People here are posting for help and what do you return? If you dont want to help, why bother posting in the thread? Not only did it waste your time typing that, it wasted my time (and others?) reading it. Try being supportive.

And yes i do have a sense of humor, i just dont put up with that kind of...(you know)

peace

Dark
TDK I Love you...... And yes, you should be scared
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 14th Dec 2005 07:10 Edited at: 14th Dec 2005 07:13
Well, I made this 2d thing. You could try to make it work in 3d. After all, it's not much fun if you don't code hard things yourself. You know what I mean? But I hope this will help since I don't really know what you are talking about much.


blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 14th Dec 2005 08:53
Quote: "WOW! pro g r ammer, you really ARE the best programmer i've ever seen! i mean, who could possibly figure out how to add 20 to a variable??"


This coming from Mr. Useless Post & Thread Necromancer himself...

Don't ever flame someone like that if you're no better yourself. Not. Good.

16-colour PNGs pwn.
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 14th Dec 2005 17:53
the "BEST" programmer,

I would suggest you stop flaming. You're social rate on this forum is decreasing. Change it while you can.

Help new people rather than flame them. Ok, adding 20 to a variable is pretty basic, but that gives you no right to discourage them from programming.

if that's too hard for you, then please leave this forums...

Immunity and Annihalation makes Immunihalation...
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 14th Dec 2005 18:39 Edited at: 14th Dec 2005 19:35
Honestly, how stupid could you be trying to start a flame? I mean why call me the best programmer, when in fact that is your username? You criticize my programming as being somewhat noobish when in fact you joined these forums 13 days after me, making you a bigger noob than me. That reason is enough to make your flame absolutely useless, boring, pointless, and pathetic and you are pathetic also. The fact that now 4 people (including myself) have pointed this out to you is shocking. Why bother to flame this post when already I have received help and encouragement, then you step in Mr. Big-Guy best programmer who can’t possibly be the BEST PROGRAMMER if you've asked for help before. Besides, your threads are also useless like you. We've already got a guide on here to make games run faster, its stickied... you know the green arrow on the folder icon above this post. I think even your small brain is capable of finding that so for goodness sake get real!

worst flame ever!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 14th Dec 2005 19:40
Maybe it's about time we use that "abuse" button. (mad smiley in right-bottom corner)

Immunity and Annihalation makes Immunihalation...
Opposing force
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: England
Posted: 14th Dec 2005 19:41
what do you mean? Report me or him?
Takeshii
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location:
Posted: 14th Dec 2005 21:38
I wouldn't see the point reporting you. I mean, yes you did flame back, but you started this asking for help. His post and others like it, are the posts that start "Flame wars", and there the ones that need to be stopped.

Dark
TDK I Love you...... And yes, you should be scared
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 15th Dec 2005 04:45
Great, flame fest, but was I able to help?

new programmer
19
Years of Service
User Offline
Joined: 20th Dec 2005
Location: right behind you.
Posted: 22nd Dec 2005 03:43
LOL. when we start, we all suck. when i started C++, i didn't understand what 'int' meant...

anyway, you're making good progress pro g r ammer!

Login to post a reply

Server time is: 2025-05-22 20:37:04
Your offset time is: 2025-05-22 20:37:04