This paper addresses the difficulties of teaching introductory programming to students in the field of information technologies and computer science. It reviews several existing approaches to make learning programming more attractive: using games or programmatically controlled hardware devices. The author believes that programming moving virtual actors motivates most of the students to learn programming. Moreover, seeing moving visual objects on the computer screen makes it easier for the students to perceive the mistakes in their code and correct them. However, writing such programs without any additional tools is not a task for a novice programmer. That is why this paper proposes an approach for teaching programming for IT professionals using a new game library, specially developed for training, which controls virtual models moving in a virtual environment. The system uses appealing 3D graphics to attract attention. Several sample programs, illustrating main features of this approach, are presented. Screenshots of the sample programs and results of teaching a pilot group of students are given at the end of the paper. Initial results show that the students enjoyed the course, most of them liked the game library approach better than the traditional one and do recommend using it in the future. More than half of the trainees improved their results.