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
Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 29th Jul 2013 02:35
I am trying to work on timer...

let just say I have 4 different type of tree going passing by

how I make code to work in timer to say if one small tree pass in say 5 seconds then put big tree in next one then put different tree after that so it doesnt make boring....

could someone show me code example on what i have said please because the work i am working is looking quite good
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Jul 2013 03:20
You can look at the Timer command. This gives you time that you can check during the app.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 29th Jul 2013 03:21
Have a look at DVaders Tutorial on Parallax scrolling - it might cover what you need.

http://forum.thegamecreators.com/?m=forum_view&t=206716&b=41
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th Jul 2013 08:48
if the difference reach your seconds you memory the timer again
for next compare.

Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 30th Jul 2013 19:57
Thanks Guys I got various things going on the screen which is good
Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 29th Aug 2013 23:14 Edited at: 29th Aug 2013 23:15
I have done the Z Ordering which I got out of the way....

Now here come next problem I having and what I want is passing different object in timer but my code isnt good

If the beast gone past 3 different object then loop it again



Do you think it is better or it isnt right?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Aug 2013 23:36
Since Timer() only ever increases, and you check it at the start of your posted logic, Parts will be stuck at 3 as soon as you go past 21 seconds. No matter how many times you set it to 1 in your select:case 3, the first line in your posted code will always reset it to 3 before you get to the select line again.

What is the sequence of events that you want to see happen?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 29th Aug 2013 23:42
AL is right, as usual.

Your are interested in elapsed time, so you need to keep the last time you did it and then subtract if from the time we're testing.

(pseudo code)

if (now - then) > deltatime
do something
then = now

Check out the use of else. You can speed things up by not doing pointless checks, and avoid some danger.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 30th Aug 2013 00:14
what I am trying to do is like this

Part 1 - Small tree go past(end of left hand side)
Part 2 - groups of trees go past(same above)
part 3 - statue go pass(same above)

then I want it go back part 1 and loop it...

can someone make my code like what I have said please
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Aug 2013 00:32
Maybe something like this.

Initialize the select parameter before your loop that is executing the other stuff:


Now, add some bits to the select to let it do the work (this assumes this is getting executed in some loop and that you have a Sync() call sometime):


I added a time check in case 3 so that the position set there would stick around for a few seconds before going back to the previous position.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Noob Programmer
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location:
Posted: 31st Aug 2013 19:26
thanks Ancient Lady

I have copy your code replace my code but the first tree went pass then second tree didnt go pass then statue went pass

I am starting to think why didnt second tree doesnt work....

it is ok if I send ya my code with the media, so that you can check it if happen the same
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 31st Aug 2013 22:13
Quote: "it is ok if I send ya my code with the media, so that you can check it if happen the same "

No. Please don't. I discourage people sending me their projects to debug. I have my own things that I need working on. Taking time to look at stuff posted here is done when I can. If someone sends me something, I am obligated to look at it. And I do not want everyone to think that I am ready to do that.

Since I don't know how you are using the code I posted, I can't tell if it works properly in your setup.

If you post more of your code, showing how it fits together, then we can all try to help.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-24 21:02:54
Your offset time is: 2024-11-24 21:02:54