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.

Dark GDK / one quick question-- should be easy.

Author
Message
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 2nd May 2008 20:08
I need a really quick code that will stop an object from going through another thing ( like terrain or an object ). I just need it so that it goes, hits the wall and then you can't move it anymore. Remember, I am moving it with the arrow keys.

This may be more complicated then I expect, but I am ready for it. Most of my codes end up with the object going backwards on and on and on and on.....

Thanks!

p.s. - I hope to post the game I am making soon, it is almost done except for that one glitch. It is a two player hide and go seek game-- a little dumb but it is..... Well, yeah it is pretty dumb but I am just making it to get the basics of c++ down.

thanks again!

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd May 2008 21:07
Nothing dumb about your game idea..

...but I think you should maybe comb the sparky demos and some other code base snippets and even the darkbasic pro forums for stuff like this.. Google is your friend! LOL... Seriously... You've been doing great and I honestly can't stop my flow to write yet another sparky collision example!

YOU CAN DO THIS!

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 2nd May 2008 21:09
ok, I have been trying all different ways but they never work.... well, I guess I'll keep at it.....

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd May 2008 21:12
Start with a separate program... two cubes, a basic camera "mover" deal - press key cam moves... and test like that. Then you'll learn it... the nitty gritty... then GO BACK and make that "knowledge" work in your program!

I have so much faith in you man! Don't be discouraged... get a bigger hammer! (Try a different way to get answer) More little test programs that only do a specific task!

I've been coding for YEEAARRSS and I STILL do that when I get stumped! (and I google ALOT!)

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 2nd May 2008 21:14
ok, thanks. Hopefully I will figure out soon, I want to get this game done before my friend gets over here, he wants to play it.

~~Its not about what you know, its about how you figure it out.~~
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 2nd May 2008 21:32
one quick question-- I am trying to use booleans in order to do what I want it to, and am I using it right?


thanks! oh, and does your game, IronInfantry have the feature of stopping at a wall?

~~Its not about what you know, its about how you figure it out.~~
pirogoth
16
Years of Service
User Offline
Joined: 6th Apr 2008
Location: Good Old California
Posted: 2nd May 2008 21:34
Quote: "I've been coding for YEEAARRSS and I STILL do that when I get stumped! (and I google ALOT!)"


Agreed. It's the best way to learn, and the easiest way to work through a problem. Eliminate everything else and focus on the specifics.

-Piro
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd May 2008 22:36
In Iron Infantry... We GO THROUGH THE FREAKING WALLS! ... LOL... just kidding

Um... Hang ON <grrr> <LOL> I like you man.. I'll give you a simple "Head Banger" demo ok?

NEEDS SPARKY's!



programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 2nd May 2008 22:55
That is exactly what I need! One question though. What does 'oy' mean? From the code it looks like it means the before y position of an object.

Anyways-- THANKS!!!!!

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd May 2008 23:52
Old Values....

You "Record" Where you at, you move... if you Hit, you restore the old values and the illusion is you just "can't" get past a certain point.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 2nd May 2008 23:56
while (collide = false )

You want to be careful here. What you really mean is

while (collide == false)

You need to understand the side effect because what you're doing looks like your loop will never run.

When you say

collide = false

you're setting collide to the value of false. But if you look at the entire expression, it evaluates to false EVERY TIME. That means your loop isn't going to run because you're passing it a false expression whenever you step into it. There's a big difference between = and ==.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 3rd May 2008 00:15
ok, got it. thanks!

~~Its not about what you know, its about how you figure it out.~~

Login to post a reply

Server time is: 2024-11-20 09:34:57
Your offset time is: 2024-11-20 09:34:57