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.

DarkBASIC Professional Discussion / beginner teacher needing help leaving a loop to a sub routine

Author
Message
classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 7th Mar 2014 21:55 Edited at: 8th Mar 2014 03:27
please remove post. thanks

bvan
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Mar 2014 22:47 Edited at: 7th Mar 2014 22:49
Without running the code it looks like when you hit object 3, you GOTO the subroutine. You need to GOSUB a subroutine. You also need to SYNC after printing hello, otherwise you won't see it. Then you need to RETURN from a subroutine.

You're also going to get stuck because you've put it in a WHILE loop, so you'll be pressing a key for a long time whilst the 2 objects are colliding, frame by frame.

classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 7th Mar 2014 23:05
We have tried it without the While..endwhile and it still didn't work and have played with sync for print. Today I did have a student try gosub instead of goto, but we did not use RETURN. I will try that next. Thank you.

bvan
classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 7th Mar 2014 23:05
We have tried it without the While..endwhile and it still didn't work and have played with sync for print. Today I did have a student try gosub instead of goto, but we did not use RETURN. I will try that next. Thank you.

bvan
tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 7th Mar 2014 23:13 Edited at: 7th Mar 2014 23:23
spaghetti


lazagne (correct and working):


Btw that's not the best use for a while loop.

Cwatson
tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 7th Mar 2014 23:19
check again had to remove ur 'wait key'. That would have caused some trouble.

Cwatson
classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 7th Mar 2014 23:20
I was able to get it to go to the subroutine finally. Yeah. But the only thing I can get it to produce is a box (no text or 3d--I am syncing) and it won't clear the screen from the previous regardless of where I place CLS. So my guess is it is the sync issue. It maybe our school environment/issues we have with our network that have plagued us with DarkBasic. Thank you though!

bvan
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 8th Mar 2014 02:16
Teacher teaching people to use goto???

Wow. I'm glad I was taught jsp.

tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th Mar 2014 04:14
Doesn't surprise me one bit. In fact remembering back to my first proramming lesson in high school I'm almost tempted to write the above teacher a lesson plan involving DB so she can inspire her students instead of putting them off coding for life like my teacher did.

Glad this one has made the effort though. My teacher made me learn in true basic by drawing black shapes on a white screen using a set of user defined function designed by the headmaster called 'turtle graphics'. Horribly tedious and off puttin.

Cwatson
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 8th Mar 2014 05:46
sounds like a LOGO emulation

classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 8th Mar 2014 15:06
tiffer, thank you for your response. As a business teacher, I received no training in coding. I agreed to teach this course so our students would have an opportunity to have some exposure to coding because nothing is offered at our school. The on-line curriculum I was to use was supposed to teach the students code only taught students to take code already written and copy and paste and put together to make a game, so I have been taking it upon myself to explore and learn it right. My resource for the game above was a YouTube video and I followed it. One problem was, half my students were eager for more, and wanted to take this snippet and go out and do a subroutine or a function. I am learning this as fast as I can. Other teachers I called around the state are using a "drag and drop" GameMaker program and say it's easier so I may need to go that route. Although I usually take the "what's best for students" route, not the easy route like many teachers, I know when to accept defeat. It was a last resort for me to post on this discussion board. I will explore other options for my students because I am certainly not working these hours to "turn them off" to technology. Quite opposite my goal. So thank you, very much, for acknowledging my efforts!

bvan
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Mar 2014 15:30
You should stick with dbpro if you want to continue persevering. It's the quickest way to get graphically immersive results. AppGameKit would be slightly easier but will cost more to set up for a class of students

tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th Mar 2014 17:27 Edited at: 8th Mar 2014 17:50
Quote: "sounds like a LOGO emulation"


I think you might be right.


Quote: " I will explore other options for my students because I am certainly not working these hours to "turn them off" to technology. Quite opposite my goal. So thank you, very much, for acknowledging my efforts!"

There's plenty of of people here willing to help. Where possible. Sorry I was drinking last night so I didn't give your code a proper look.

Try this for now and maybe sunday I'll post something else up.





FYI I live in scotland so it's 1630 on saturday here.

Cwatson
tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th Mar 2014 17:38 Edited at: 8th Mar 2014 18:07
Try this This is based on what I think you were originally trying to do.



Cwatson
tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 8th Mar 2014 18:18 Edited at: 8th Mar 2014 18:20
This should do nicely as a graphical representation of what the main loop does.

Download button on the bottom of this post. It's a pdf file.

Cwatson
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 9th Mar 2014 01:05
Quote: "It was a last resort for me to post on this discussion board."


It should be your first, for over a decade it has been where I turn first.
Tell your students to learn how to search these forums any time they have a question.
There is over a decade of great knowledge here.
Don't give up more teachers should be using DBPro.

[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 9th Mar 2014 16:15
Thank you both SO much. I guess I should have better explained what our goal was, but thought this was going to be an simple answer of something we were overlooking. I have MANY kids who ARE going to this forum and finding code and learning. (100 kids originally signed up for this class). These students are working above the class. They want to be in the classroom with me constantly now (before school, after, during my lunch) to do this, but they have all come across the same road block and I thought this might be a simple example. (I didn't actually include the original subroutine, just trying to print HELLO to keep it simple.

Another example, I have a student who has an INTRO screen and has a mouse rollover. Like the snippet I shared above for the movement of the sphere, these things require a loop. And we are struggling with getting out of that loop to go somewhere else. We started with IF..ENDIF, it was suggested to us to try the WHILE..ENDWHILE (which is why that was in there). Also, struggling with, if we turn sync on something works, but another doesn't, so have to choose. (can't have it all). I hope this comes with experience once I can figure out the trick. The flow chart may help with the sync issue for me.

Thank you for taking the time to create the flow chart. I have some less advanced students (5 Special Ed kids in one class as well) I think this will be GREAT for I wish I had more resources like this in fact I was thinking if more teachers used this, what a great opportunity to write some curriculum designed for Junior High and High School age to sell. My original goal for this class was to get a consortium for our state and get enough teachers using it and have a video game state competition, but I thought my curriculum was going to be better. (Wyoming is a small state and I know almost all the business teachers around the state and had them on board, but they decided to go the GameMaker route instead) and right now I understand why. I asked my students last week if they wanted to take that route and they said, "no way, we won't learn any life skills from doing it that way."

I will play with the editor today. If it is something the students could benefit from, will require going through the tech dept to be used. But even if it helps me to help them, it will make a difference.

Again, my sincerest appreciation for your helpfulness. Your time is very much appreciated.

bvan
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Mar 2014 08:43
IF you want some lesson material, then start at Newlsletter 49, and work your way through the 10 fundamentals lessons. I wrote these with this kind of scenario in mind.

You can then jump back to issue 45, where there is the start of a 3-part space invaders tutorial. I wrote this one to demonstarte the "State Machine" approach to making a game. By the end of these, you'll be a genius!

https://www.thegamecreators.com/?gf=newsletter

tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 12th Mar 2014 19:41
You tend to find that the majority of issues people need help with on this forum aren't so much technical problems as they are logical flaws they've overlooked. If your program doesn't compile it's most likely to be a syntax error or nesting error or something like that. If it runs but doesn't behave correctly it usually means the logical design isn't quite right or perhaps you aren't using the commands correctly.

The problem your original code wasn't that the text wasn't showing it was because the text only got printed for 1/60th of a second and then the program got stuck between a looped condition and a while loop. I realised you were going for a pong sort of thing which is why I edited the program to simply rotate the ball 180 as if it was bouncing back and forth.

Flowcharts are a good way to design a solution and even if it doesn't feel necessary at the time it will give you something to look back at in the imminent debugging phase.

The truth about developing software is few programs written work perfectly the first time. I think there's still an ongoing argument between Russia and NASA over who has the fewest errors.

That's why we talk about the alpha and beta development phase. This is where you design your program, write it, see where the problems lie and then rewrite or correct the bits that don't work. Then.. release it to some beta testers who will do their damndest to find more faults for you to fix.

Cwatson
classroomtchr help
12
Years of Service
User Offline
Joined: 7th Mar 2014
Location:
Posted: 24th Mar 2014 03:17
Newsletter editor:Thank you for the reference on the Newsletters. This has been MOST helpful. I have a question, you may not have time to answer and if so, I understand. I was gonna try and have my students walk through all the steps for the Space Invaders game. I was considering trying to immerse them in the whole experience so have them make their own Invader and mothership in paint, but I noticed in the code you also use .dbo (DarkBasic Object) files for some of the images and the scoring. The images I can view in paint don't really look as they appear in game. So, my question is, would this be worthwhile to have them make their own, or since I really don't know how to view or work with the .dbo files, I should have them use the media provided to keep it simple. Remembering, these are all beginner students who have no coding experience, except the few weeks they have been with me?

bvan
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Mar 2014 14:47
The dbo files are 3D objects. Generally 3D models are made in .X or sometimes 3DS format; dbo files are optimised .X files for DarkBASIC Professional.

If you wanted to replace them directly you would need to make 3D models. You could use a free program like Wings 3D. However, this is a skill in itself and could take up many hours.

Another alternative is to replace the models with plains (MAKE OBJECT PLAIN), and simply texture them with a simple 2D image of the invaders (LOAD IMAGE, TEXTURE OBJECT). I don't have access to the source code on this computer, so I'm not sure if it will affect the games mechanics, such as collision.

Using textured plains would make the process more fun - your students could use photos of themselves as aliens for example.

tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 24th Mar 2014 15:37
If it's a space invaders thing could u not just slap a picture onto a plane object.

Cwatson
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Mar 2014 23:25
Quote: "set of user defined function designed by the headmaster called 'turtle graphics'. Horribly tedious and off puttin."

As Kevin said, sounds like LOGO. We did a DBP challenge for it:
http://dbcodecorner.com/index.php?page=view&challenge=Logo&lang=pro


Quote: "As a business teacher, I received no training in coding. "

Is that really a good idea to teach kids a subject you're not familiar with yourself? Programming is a little different than teaching facts out of a history book.

Quote: "If it's a space invaders thing could u not just slap a picture onto a plane object."

Then you have to worry about what depth to set the objects positions to make the sizes look correct. I'd use sprites and keep it 2D. Maybe now is a good time for me to finish writing my space invader tutorial.

There's a lot of fundamentals new coders need to learn before having them create an entire game, even a simple one.

tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 25th Mar 2014 01:09 Edited at: 25th Mar 2014 01:22
Quote: "Is that really a good idea to teach kids a subject you're not familiar with yourself? Programming is a little different than teaching facts out of a history book."


Are you reading Sheldon's lines from 'The Big Bang Theory'?

In case you haven't seen it Sheldon cooper is the dull socially awkward character who constantly alienates himself from friends with his insulting narcissistic lectures.

Quote: "
There's a lot of fundamentals new coders need to learn before having them create an entire game, even a simple one."

Maybe read the domain name above?

Quote: "As Kevin said, sounds like LOGO. We did a DBP challenge for it:"


You sound like a riot!

@Everyone else.
Just to be clear I wrote my first 3d game on downtime in Iraq (arcade shooter) and without any tutors to teach me about 'the 'principles of programming'. There's no black art to it. It's problem solving using the commands that are given.

I've no time for Grandads trying to tell everyone they can't write a game until they've mastered Binary and Trigonometry. It's nonsense!

Cwatson
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Mar 2014 02:06
Why are you trying to insult me?

Quote: "Just to be clear I wrote my first 3d game on downtime in Iraq (arcade shooter) and without any tutors "

And I did mine at 13yr old without any tutors, before the internet, whats your point? If you rewrote it today, would you not write it differently? More efficiently? I know I would with my first programs. Just because your code works does not mean it was designed well or that you should be teaching it.

A good solid foundation is important if you are to teach it to others to avoid teaching them any bad habits you may not even be aware of yet. Would you take driving lessons from a teenager who got their license last week?


Quote: "I've no time for Grandads trying to tell everyone they can't write a game until they've mastered Binary and Trigonometry. It's nonsense!"

At no point did I say he couldn't write a game.

Quote: "Programming is a little different than teaching facts out of a history book."

The point of this statement was that you cannot simply read a book about programming and expect to teach it right away without first developing a working experience. Because I've had a java teacher that appeared to know little more than what it sounds like she read about only a week ago. I ended up having to teach the other kids myself during lab time because she had know clue what she was talking about, only reciting book text.

Quote: "I've no time for Grandads trying to tell everyone they can't write a game until they've mastered Binary and Trigonometry. It's nonsense!"

Not binary, but they should understand program flow and structure before writing an entire game. That's just common sense!

So if you want to insult me by calling mr a narcissistic granddad, I don't care.



classroomtchr help, don't let tiffer's rant make you think I'm opposed to you teaching. I just want to understand how you plan on teaching this to kids when you're still learning it yourself. This is in no way an insult.
Is this a graded course or an after-school program?

Quote: " a "drag and drop" GameMaker program and say it's easier so I may need to go that route."

It depends on what your goal is. If this is just a fun after-school activity to make a game, then sure why not. But if you want to teach them programming, I would skip drag n' drop software from the start.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 25th Mar 2014 02:36
I don't personally see anything wrong with "teaching" a class based on something you aren't familiar with yourself, so long as the students know that you're learning together from the start. One of my education instructors once told me how he tried to teach blender to his art students and they ended up teaching him.
Of course you'd have to have self-motivated students, and something like this would probably work much better as an after school program than as it's own class.
On the flip side, I had a Photoshop teacher who didn't know anything about it, wouldn't admit that she knew nothing about it, and literally read word for word from a book on photoshop throughout every class period.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Mar 2014 03:59
Quote: "One of my education instructors once told me how he tried to teach blender to his art students and they ended up teaching him. "

I mean that's good for the teacher but then what were the students learning? At that point it really just becomes a self-study class doesn't it?

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 25th Mar 2014 05:37
The way I see it is it's time set aside for the kids to experiment. One of the things I keep in mind while teaching is that it's important for me to let them fail (a task, not a letter grade) because that's how we learn what works and what doesn't. Maybe if they didn't have that class time set aside they'd never give doing 'whatever' a chance, even if they had the time to do so outside of school.
I think it comes down to this:
Quote: "what were the students learning?"
+
Quote: "a self-study class "
my meaning being that people have to choose to learn; you can teach your butt off and they won't remember a thing if they don't want it. And if they want it, they'll put the effort in to learn it. The most important part of teaching is making them want it.
That's my 12:30 am point of view, anyway.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Mar 2014 08:37
The class is better than having nothing at all, that's for sure. And I can see what you mean. There were many times I had a class (not necessarily programming) where I wanted to just try something but didn't have the freedom to try it, or couldn't afford to.

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Mar 2014 09:53 Edited at: 25th Mar 2014 09:54
[Mod hat on]Please keep the thread on topic, learning to program can be done in a thousand ways and we all have personal opinions. I believe this thread is about an "out of hours" hobby session.[mod hat off]

In case it was missed, he is now using the 10 lessons on programming basics followed by a space invaders 3-part lesson that teaches structured programming while getting a quick result that will encourage the pupils to experiment along the way. It is true that the game contains elements that are beyond a beginner, but it is highly modularised and ensures small parts can be modified in order to be creative while learning how it all ticks.

tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 25th Mar 2014 14:24 Edited at: 25th Mar 2014 14:34
So my point is if you it's a space invaders game shot at one angle. One way to be creative would be to replace the 3d model of the space ship with a flat plane and a picture on it. You wouldn't need to worry about calculating depth because it would be in the exact same position using the exact same variables as the 3d model.

@ Phaelax I wasn't insulting you but I think you need to lighten up. I think anyone that's seen The Big Bang Theory ' would agree your comment was very Sheldon-ish.

Cwatson
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Mar 2014 15:28

Trying to be subtle here, but would that be what was mentioned earlier...

Quote: "Another alternative is to replace the models with plains (MAKE OBJECT PLAIN), and simply texture them with a simple 2D image of the invaders (LOAD IMAGE, TEXTURE OBJECT). I don't have access to the source code on this computer, so I'm not sure if it will affect the games mechanics, such as collision.

Using textured plains would make the process more fun - your students could use photos of themselves as aliens for example."


tiffer
20
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 25th Mar 2014 16:04
My bad. I just got new glasses

Cwatson

Login to post a reply

Server time is: 2026-07-11 19:01:05
Your offset time is: 2026-07-11 19:01:05