flashing screen

BlitzMax Forums/BlitzMax Beginners Area/flashing screen

Eric Vaughn(Posted 2006) [#1]
Hi there,

I'm very new to BlitzMax and I am learning how to code in it from things on the internet, but it is very tough.

When I compile and test this, the screen flashes.


-


' -------------------- '
' Meltdown Source Code '
' Eric Vaughn 2006 '
' -------------------- '

' Initialize Window

Graphics 400, 300, 16

HideMouse

' Load Images

player:TImage = LoadImage("images/player.bmp")

' Draw Images

Cls

DrawImage(player, 10, 10)

' Main Loop

While Not KeyHit(KEY_ESCAPE)

' Draw Screen

Flip

Wend

ShowMouse


-


How do I stop the flashing?

Thanks.


Gabriel(Posted 2006) [#2]
Move the While Not KeyHit(KEY_ESCAPE) back so that it comes after the player:TImage=LoadImage and before the Cls.

You're clearing the screen and drawing an image once, and from that point on you're just flipping the buffers for no good reason. You have to draw what you want seen every frame.


Eric Vaughn(Posted 2006) [#3]
Ok it works now, thanks!


Boulderdash(Posted 2006) [#4]
Here's some help, I fixed your code and made some changes so many objects can be handled instead of just one.

Copy and Paste for BMAX (Just change the [,] backets for B3D )



Boulderdash(Posted 2006) [#5]
In this example there are four images on the screen using data, image 1 is controlled by I,J,K,L

No Doubt in your game you will want more than one image




Boulderdash(Posted 2006) [#6]
This one has moving Images and One controlled by the keyboard... The basics of any game.

I have tested this in BMAX, it should only need the brackets changed with the arrays to make it work in B3D.