Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Program Exit

This thread is locked; no one can reply to it. rss feed Print
Program Exit
Adrian Gabriel
Member #16,135
December 2015

Hello, I have a problem. When I try to move a bitmap above an another bitmap, sometimes the program exit without any message.. where is the error.. One bitmap has the coord of my mouse (x,y).. and another is fixed. If I don't move a bitmap above an another bitmap everything it's ok but I need to pass over it in order to increase the "score"... Sorry for my bad english.
This is the code:

http://pastebin.com/YSB3v1PN

Dizzy Egg
Member #10,824
March 2009
avatar

Shouldn't you be calling set_target_bitmap(display) or something?

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Adrian Gabriel
Member #16,135
December 2015

I don't know, I've started to learn allegro 5 three days ago because I need it for a project..

Dizzy Egg
Member #10,824
March 2009
avatar

Try calling al_set_target_bitmap(display), draw your bitmaps onto that, and then flip to the screen...

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Adrian Gabriel
Member #16,135
December 2015

I've put
al_set_target_bitmap(player);
al_set_target_bitmap(player2);
al_draw_bitmap(player2, x2, y2, ALLEGRO_FLIP_HORIZONTAL);
al_draw_bitmap(player, x, y, ALLEGRO_FLIP_HORIZONTAL);

and I've received this error:

http://s11.postimg.org/ymnj43d43/Screen_Shot_20151222171222.png

Dizzy Egg
Member #10,824
March 2009
avatar

No, you set your 'display' bitmap as the active bitmap, then draw your 2 small ones on that

set_target(display)
draw_small
draw_small
set_target(screen)
draw_big
flip_display()

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

SiegeLord
Member #7,827
October 2006
avatar

You need to wrap the switch (events.keyboard.keycode) { switch in an if statement that verifies that the event type is ALLEGRO_EVENT_KEY_DOWN (or similar keyboard event).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Adrian Gabriel
Member #16,135
December 2015

SOLVED! HUH! THX A LOT ALL!!

Dizzy Egg
Member #10,824
March 2009
avatar

Good stuff!

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Go to: